View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas[_2_] Gary Keramidas[_2_] is offline
external usenet poster
 
Posts: 364
Default Why I get #Name? When I use a sub

you have a circular reference. it is putting your formula in a2 and your
wanting the sum of a1:a5

--


Gary


"ciccia" wrote in message
...
From the Excel, I tried to use Visual Basic Edit to create some
sub/functions.

Private Sub Worksheet_Calculate()
Worksheets("Sheet1").Activate
ActiveSheet.Cells(2, 1).Formula = "=Sum(A1:A5)"
End Sub

From the Sheet1, I enter "Worksheet_Calculate()" in a cell.
#Name? displays in the cell where I entered the sub name.
Why?