J
James Bond
Thanks to all who have already helped with my little significant figures
function. I have ended up with this little function:
Function Sig(Num, Dig)
Sig = WorksheetFunction.Round(Num, Dig - 1 - Int
(WorksheetFunction.Log10(Abs(Num))))
End Function
There is only one thing left for my function to do and I need some help
deciding the best way to go about it.
The one thing my significant figures function does not do is properly add
zeros to the right of a number when needed. For example, the number 5,
when expressed in 3 significant digits, would be 5.00.
Now first I am going to have to make my function determine when it needs
to actually add zeros and then append them, but I assume that even when I
figure out how to do that, I will run into a problem with formatting
since the general format will not show any trailing zeros (yet I don't
want to have to specifiy ahead of time a number formatting with x decimal
places).
So I was thinking one way to do this would be to have my VBA function
determine if zeros need to be added and then change the formatting of the
active cell on the fly to accomodate that number of decimal places. Now
I don't really know exactly how to make all that happen yet, but that is
the direction I am heading.
So basically, before I start figuring out how to do all this, I was
hoping for some feedback regarding my plan. If there are better/easier
ways to achieve this I would like to hear about it.
TIA
James
function. I have ended up with this little function:
Function Sig(Num, Dig)
Sig = WorksheetFunction.Round(Num, Dig - 1 - Int
(WorksheetFunction.Log10(Abs(Num))))
End Function
There is only one thing left for my function to do and I need some help
deciding the best way to go about it.
The one thing my significant figures function does not do is properly add
zeros to the right of a number when needed. For example, the number 5,
when expressed in 3 significant digits, would be 5.00.
Now first I am going to have to make my function determine when it needs
to actually add zeros and then append them, but I assume that even when I
figure out how to do that, I will run into a problem with formatting
since the general format will not show any trailing zeros (yet I don't
want to have to specifiy ahead of time a number formatting with x decimal
places).
So I was thinking one way to do this would be to have my VBA function
determine if zeros need to be added and then change the formatting of the
active cell on the fly to accomodate that number of decimal places. Now
I don't really know exactly how to make all that happen yet, but that is
the direction I am heading.
So basically, before I start figuring out how to do all this, I was
hoping for some feedback regarding my plan. If there are better/easier
ways to achieve this I would like to hear about it.
TIA
James