hi, everyone, I am new for VBA, please someone helps me on this problem.
the question is after i got the data from my local drive, i have a difficulty to calculate my weighted average in specific cell. I put what i wrote down for a reference. very appreciate your help.
sub WeightedAverageCalculation()
Dim pathname As String
Dim filename As String
Dim fullname As String
'S:\............" is my local file path
pathname = "S:\Jobs and Income Indicators Project\1994-2006 Files\Provinces\"
'filename is my using workbooks
filename = "Table27.1aAllYears.xls"
fullname = pathname & filename
'Range("b5").Select
'ActiveCell.FormulaR1C1 = _
'"='fullname'!r5c14"
Range("b6").Select
ActiveCell.FormulaR1C1 = _
"=sumproduct('fullname'!r6c3:r9c3,'fullname'!r6c14 :r9c14)/sum('fullname'!r6c3:r9c3)"
End Sub
leo
the question is after i got the data from my local drive, i have a difficulty to calculate my weighted average in specific cell. I put what i wrote down for a reference. very appreciate your help.
sub WeightedAverageCalculation()
Dim pathname As String
Dim filename As String
Dim fullname As String
'S:\............" is my local file path
pathname = "S:\Jobs and Income Indicators Project\1994-2006 Files\Provinces\"
'filename is my using workbooks
filename = "Table27.1aAllYears.xls"
fullname = pathname & filename
'Range("b5").Select
'ActiveCell.FormulaR1C1 = _
'"='fullname'!r5c14"
Range("b6").Select
ActiveCell.FormulaR1C1 = _
"=sumproduct('fullname'!r6c3:r9c3,'fullname'!r6c14 :r9c14)/sum('fullname'!r6c3:r9c3)"
End Sub
leo