View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Trevor Shuttleworth Trevor Shuttleworth is offline
external usenet poster
 
Posts: 1,089
Default Newbie : How to sum cells via VBA code.

Rich

works for me:

Sub test2()
lcRange = "B3:B35"
ActiveCell.Value = "=sum(" & lcRange & ")"
End Sub

Regards

Trevor


"Rich" wrote in message
om...
I am using Excel 97.

I want to sum the values of several cells. I tried to follow the
examples that I see in this forum and they don't work. My code looks
like :

lcRange is equal to B3:B35

ActiveCell.Value = "=sum(" & lcRange & ")"

I thought that the above command would sum up the values in a column
like an auto sum. But it does not work. Can anyone help me ? How can I
sum ???

Rich