Sum Dynamic Range - VBA
Can anyone tell me why the end result of this function gives me the
#NAME? error in cell F2?
Function RangeTot()
Dim myLastCell As String
Dim myFirstCell As String
Selection.End(xlDown).Select
myFirstCell = ActiveCell.Address
Selection.End(xlDown).Select
myLastCell = ActiveCell.Address
Range("F2").Select
ActiveCell.FormulaR1C1 = "=sum(myFirstCell" & ":myLastCell" & ")"
End Function
TIA,
Chris
|