Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Trouble with UDF - getting #NAME error
I created the following UDF in order to show the last saved date:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) ThisWorkbook.Names.Add Name:="LastSaved", _ RefersToR1C1:="=""" & _ Format(Now, "mmm-dd-yyyy hh:mm") & """" End Sub When I enter in a cell =lastsaved or lastsaved() I get the error #NAME. What am I doing wrong? Thanks, Joe M. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Trouble with UDF - getting #NAME error
Did you put the code under the ThisWorkbook module?
Did you save the workbook at least onced so the event would fire and the name would be created? Did you ever have a function/name/module name called "LastSaved" in the troublesome workbook? Since you're refering to a name, you don't want the () in your formula. Just use: =LastSaved Joe M. wrote: I created the following UDF in order to show the last saved date: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) ThisWorkbook.Names.Add Name:="LastSaved", _ RefersToR1C1:="=""" & _ Format(Now, "mmm-dd-yyyy hh:mm") & """" End Sub When I enter in a cell =lastsaved or lastsaved() I get the error #NAME. What am I doing wrong? Thanks, Joe M. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IRR Trouble | Excel Worksheet Functions | |||
Trouble with IF | Excel Worksheet Functions | |||
UDF trouble | Excel Discussion (Misc queries) | |||
more trouble with i | New Users to Excel | |||
Trouble shooting#NA error in Array formula | Excel Discussion (Misc queries) |