Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CH CH is offline
external usenet poster
 
Posts: 49
Default User Defined Functions

I occasionally mke user-defined functions in VBA. I am trying to write a
function using the LOG10() function and the FIXED() function and I get an
error for both of these functions - - unlike when I use other canned
functions. Are there limitations to the functions I can use in a
user-defined function? LOG() works, so I can work around the LOG10()
function.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,365
Default User Defined Functions

If you're trying to use the LOG10() function inside of a VBA module, well,
there ain't no such animal.

Static Function Log10(X)
Log10 = Log(X) / Log(10#)
End Function

There's some workaround code that will give you LOG10() using Log() (which
is available in VBA).
Similarly, there is no FIXED() in VBA - that's also a worksheet only
function. Closest thing in VBA is probably FIX(n) where n is a number, and
FIX(n) returns the integer portion of n.


"CH" wrote:

I occasionally mke user-defined functions in VBA. I am trying to write a
function using the LOG10() function and the FIXED() function and I get an
error for both of these functions - - unlike when I use other canned
functions. Are there limitations to the functions I can use in a
user-defined function? LOG() works, so I can work around the LOG10()
function.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,440
Default User Defined Functions

LOG10 and FIXED are not VBA functions. Use Application.Worksheetfunction.LOG10 if you have to.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"CH" wrote in message ...
|I occasionally mke user-defined functions in VBA. I am trying to write a
| function using the LOG10() function and the FIXED() function and I get an
| error for both of these functions - - unlike when I use other canned
| functions. Are there limitations to the functions I can use in a
| user-defined function? LOG() works, so I can work around the LOG10()
| function.


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 947
Default User Defined Functions

...using the LOG10() function and the FIXED() function and I get an
error for both of these functions


Sub Demo()
Debug.Print WorksheetFunction.Log10(100)
Debug.Print WorksheetFunction.Fixed(1 / 7, 2)
' or...
With WorksheetFunction
Debug.Print .Log10(100)
Debug.Print .Fixed(1 / 7, 2)
End With
End Sub

--
HTH :)
Dana DeLouis
Windows XP & Office 2003


"CH" wrote in message
...
I occasionally mke user-defined functions in VBA. I am trying to write a
function using the LOG10() function and the FIXED() function and I get an
error for both of these functions - - unlike when I use other canned
functions. Are there limitations to the functions I can use in a
user-defined function? LOG() works, so I can work around the LOG10()
function.



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default User Defined Functions

please see Neik's answer. You need write the full path reference when you use
worksheetfunction. Obviously, You lost key word "Application." before
"WorksheetFunction.Log10(100)"

"Dana DeLouis" wrote:

...using the LOG10() function and the FIXED() function and I get an
error for both of these functions


Sub Demo()
Debug.Print WorksheetFunction.Log10(100)
Debug.Print WorksheetFunction.Fixed(1 / 7, 2)
' or...
With WorksheetFunction
Debug.Print .Log10(100)
Debug.Print .Fixed(1 / 7, 2)
End With
End Sub

--
HTH :)
Dana DeLouis
Windows XP & Office 2003


"CH" wrote in message
...
I occasionally mke user-defined functions in VBA. I am trying to write a
function using the LOG10() function and the FIXED() function and I get an
error for both of these functions - - unlike when I use other canned
functions. Are there limitations to the functions I can use in a
user-defined function? LOG() works, so I can work around the LOG10()
function.




Reply
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
problem with user defined function panjo Excel Discussion (Misc queries) 3 June 16th 06 11:18 AM
User defined charts Ajay Charts and Charting in Excel 0 January 17th 06 12:58 PM
Format a cell with numbers and user defined text Rod R. Excel Discussion (Misc queries) 0 March 30th 05 04:31 PM
Excel user defined functions. Matt Excel Worksheet Functions 4 March 15th 05 07:22 PM
User defined charts- font size too small Bill B Charts and Charting in Excel 1 December 30th 04 06:23 PM


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