Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Did you put the subroutine in a General module in that workbook's project? (It doesn't belong behind any worksheet and it doesn't belong behind the ThisWorkbook module.) Did you spell the name of the function correctly in the cell? Did you allow macros to run when opened the workbook? If you put the function in a different workbook (like personal.xls), then you have to tell excel where to find it: ='personal.xls'!GetSheetName() jodleren wrote: On Jul 8, 9:23 pm, Chip Pearson wrote: GetSheetName = ActiveSheet.Name That is probably not what you want. With that code, the function will return the name of whatever sheet happens to be active when Excel decides it is time to calculate. There is no certainty that ActiveSheet will be the same as the sheet on which the formula resides. This can cause problems that may be hard to diagnose. Instead, use Application.Caller, which, when called from a worksheet cell, will return a Range reference to the cell whence the function was called. Function GetSheetName() As String GetSheetName = Application.Caller.Worksheet.Name End Function Well, the result is the same: #NAME? Error. When I search for help on the error it tries to download something, but fails. BTW, the same problem aplies to Visual Studio 2008, all help requests are replied by "information not found". /S -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007, I write macros in 2003 is 2007 similar for VBA? Pros andcons please | Excel Programming | |||
Excel 2007 macros - how to merge 5 macros together into one | Excel Discussion (Misc queries) | |||
Excel Functions and Macros | Excel Discussion (Misc queries) | |||
excel functions in macros | Excel Programming | |||
Excel: Deleting Macros and Functions | Excel Programming |