log and round

hill0093

Board Regular
Joined
Dec 4, 2011
Messages
163
I am just trying to learn about round() and log().
Compiler doesn't like the log line.
What would be correct?
Code:
Function funcNam(funcArg As Double) As String
  Dim logArg As Double
  Dim rndLogArg As Double
  logArg = Log10{funcArg)
  rndLogArg = Round(logArg, 0)
  Sheets("WrkShtNam").Cells(7, 9).Value = funcArg     'for debug
  Sheets("WrkShtNam").Cells(8, 9).Value = logArg      'for debug
  Sheets("WrkShtNam").Cells(9, 9).Value = rndLogArg   'for debug
  funcNam = rndLogArg
End Function
Also if I changed this function to a Sub, how do I call it?
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
logArg=application.Log10(funcArg)
or
logArg=worksheetfunction.Log10(funcArg)
or
logArg=application.worksheetfunction.Log10(funcArg)
 
Upvote 0
The compiler calls the left parenthesis an invalid character in each line.
Code:
logArg=Log10(funcArg)
logArg=application.Log10(funcArg)
logArg=worksheetfunction.Log10(funcArg)
logArg=application.worksheetfunction.Log10(funcArg)
 
Upvote 0
The first line causes complaint as expected, but the other three compile fine here.
What version of excel are you using?
 
Upvote 0
I tested this on Excel 2003 and 2010 - no compile errors.
Have you tried just running the code?
 
Upvote 0
Ya, I discovered my error, but I'm too embarrassed to
tell you that it was a curly bracket that I didn't
notice even if it was pointed out to me.
Thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,218,795
Messages
6,144,527
Members
450,550
Latest member
Melanie_Annies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top