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: 25
Default Formatting cell poulated by User Defined Function

I have a UDF that goes off and retrieves various pieces of data from a
database based on parameters that the user enters into the UDF. Some of the
data in the DB are strings, and others are Integers or Doubles.

My UDF returns a string so that any of those values can be displayed (i.e.
ints and doubles from the DB are converted to string in my method that calls
the DB).
Public Function MyUDF(param1, param2) As String

If a value coming back from the database is the number 3.51, the UDF returns
it to the calling cell as "3.51". If I try to format this in Excel and ask
it to display one decimal point, for example, it does nothing because it
treats 3.51 as a string.
If I wrap the call to the UDF with =VALUE, that works, but I wanted to avoid
having the user have to do this. I also wanted to avoid having seperate UDFs
for each return type (i.e. one that returns String, one that returns
Integer, etc.)

Does anyone have any suggestions?


 
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
Can I Assign A User Defined Function To A Cell? smartin Excel Worksheet Functions 0 June 28th 09 10:25 PM
Which cell is calling a user-defined function? Randy in Calgary Excel Programming 1 February 11th 08 04:04 PM
User Defined Function - Using Cell Range I need help please Excel Programming 3 May 2nd 07 11:14 PM
current cell in user-defined function Julio Kuplinsky Excel Programming 3 December 8th 03 06:24 PM
User defined function & formatting Bob Phillips[_5_] Excel Programming 3 September 10th 03 12:12 AM


All times are GMT +1. The time now is 12:25 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"