View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] cfatz1@gmail.com is offline
external usenet poster
 
Posts: 36
Default 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