Hi, buddy, anyone can help me to figure out why this one does not work. very appreciate you help. Thanks in advance!
Sub WeightedAverageCalculation()
'
'this one is doing weighted average calculation
'from different file paths, different workbooks and different worksheets
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim path As String
Dim filename As String, tabname As String
Dim fullname As String
'"S:\,,,,,| is my path under S drive
path = "S:\Jobs and Income Indicators Project\1994-2006 Files\Provinces\"
'filename is my workbook name
filename = "[Table27.1aAllYears.xls]"
tabname = "All Atlantic Provinces"
'fullname is combination of path and filename together
fullname = path & filename
'do some calculation in a new workbook and I work at a new worksheet 'named "all atlantic province"
Range("c5").Select
ActiveCell.FormulaR1C1 = "=SUM(" & "" & fullname & tabname & "" & "!r5c3:r7c3)"
'I just ignore the rests of them; because if this one works, others should 'work too
End Sub
Sub WeightedAverageCalculation()
'
'this one is doing weighted average calculation
'from different file paths, different workbooks and different worksheets
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim path As String
Dim filename As String, tabname As String
Dim fullname As String
'"S:\,,,,,| is my path under S drive
path = "S:\Jobs and Income Indicators Project\1994-2006 Files\Provinces\"
'filename is my workbook name
filename = "[Table27.1aAllYears.xls]"
tabname = "All Atlantic Provinces"
'fullname is combination of path and filename together
fullname = path & filename
'do some calculation in a new workbook and I work at a new worksheet 'named "all atlantic province"
Range("c5").Select
ActiveCell.FormulaR1C1 = "=SUM(" & "" & fullname & tabname & "" & "!r5c3:r7c3)"
'I just ignore the rests of them; because if this one works, others should 'work too
End Sub