View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Function name not recognized

go into the vbe, do Insert = Module with your workbook the active project.


This gives you a general module. All functions that you want to call in a
worksheet should be in a general module not in class modules like

Sheet modules
Userform modules
ThisWorkbook module.

--
Regards,
Tom Ogilvy

"John H" wrote in message
...
I have a function that accesses and totals specific cells on different

worksheets. I cannot get it to run when called in a cell:
=TotalRSVP("676"). I have attached this code to the specific worksheet, in
a module, "This Workbook" and in the userform code sections. I get a #NAME
code in the cell. Macros are enabled. I get this on both Excel 2000 and XP.

The function's opening code:

Function TotalRSVP(strCouncil As String) As Integer ' Used Private and

Public but still did not run
... ' other dims
Dim strTempMonth

For Each strTempMonth In strMonth ' Breakpoint set here
With Worksheets(strTempMonth)
....

strMonth is a global and is set on workbook opens (works). All other code

in the userform works.

NOTE: This is the same Worksheet whose name or "Sheet1" is not recognized

and I have to access it with its numeral (1).