Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / September 2007

Tip: Looking for answers? Try searching our database.

Adding names to a cell - application-defined or object-defined error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris - 20 Sep 2007 19:27 GMT
I made my own user defined function to act as a test function for me
to try some stuff out in a sub that is being ran from a button.

My test function is

Function testFunc() As Integer
   On Error GoTo errhandler
   ActiveWorkbook.Names.Add Name:="ZOMGNAME", RefersTo:="=Sheet1!X20"
   testFunc = 1
errhandler:
   MsgBox Err.Description
End Function

The error I get is application-defined or object-defined error

The function exists in the workbooks Module1 module

Why am I getting the error?

Thanks in advance
Dave Peterson - 20 Sep 2007 20:31 GMT
You don't have any cell that contains a formula that tries to use this function,
right?

I couldn't duplicate the error as long as I had a worksheet named Sheet1 in my
activeworkbook.

ps.  You may want to avoid the errhandler if there is no error.

Option Explicit
Function testFunc() As Integer
   On Error GoTo errhandler
   ActiveWorkbook.Names.Add Name:="ZOMGNAME", RefersTo:="=Sheet1!X20"
   testFunc = 1
   Exit Function
errhandler:
   MsgBox Err.Description
End Function

> I made my own user defined function to act as a test function for me
> to try some stuff out in a sub that is being ran from a button.
[quoted text clipped - 16 lines]
>
> Thanks in advance

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.