LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Returning text from Userdefined Functions

Hello!

I have a user defined function to write data back to a database in my Excel
sheet. I return a smal text to show the user if the function was successful
or not. When I set the return value of the function in regular code, it works
fine. But, when something goes wrong, the execution goes to an error handler,
the function does not return the string I set anymore.

I have the code:


Public Function WriteData()
on error goto ErrorHandler

..
..
calculations
..
..

WriteData = "OK" 'This is returned correct to the
cell

goto End

ErrorHandler:

WriteData = "Not OK" 'This returns #VALUE to the cell

End:

End Function


Can someone tell me the reason of this behavior, and/or what I am doing wrong?

Regards DagL
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UserDefined Functions ExcelMonkey[_190_] Excel Programming 0 March 21st 05 03:05 PM
Returning range object from custom functions agarwaldvk[_9_] Excel Programming 3 August 1st 04 10:46 PM
Functions returning multiple answers Clint[_4_] Excel Programming 2 July 26th 04 06:55 PM
Returning Error from Functions LeninVMS[_4_] Excel Programming 3 April 9th 04 06:27 PM
Passing Parameters to Userdefined Functions Peter M[_3_] Excel Programming 3 December 13th 03 07:56 PM


All times are GMT +1. The time now is 05:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"