![]() |
Create a marcro that changes number of decimal places in a field according to specified criteria
Hi people, hope you can help me
I need a macro to do the following: 1. A1 contains a value - 2 (which determines the number of decimal places 2. A2 contains a value - 10 3. A3 gives the results - i.e A1 is number of decimal places for A2 therefore = 1.0 Can this be done Thank you for your help Hayley |
Create a marcro that changes number of decimal places in a field according to specified criteria
Hayley,
it can be done, but is there any reason why this would have to be done with a macro? The easiest way would just be to have a formula dividing A2 by 10 to A1-th power like this: =A2/(10^A1) The equivalent in VBA would be something like: Cells(3,1).value = cells(2,1).value/(10 ^ Cells(1,1).value) Cheers, Pete -----Original Message----- Hi people, hope you can help me. I need a macro to do the following:- 1. A1 contains a value - 2 (which determines the number of decimal places) 2. A2 contains a value - 104 3. A3 gives the results - i.e A1 is number of decimal places for A2 therefore = 1.04 Can this be done? Thank you for your help. Hayley . |
All times are GMT +1. The time now is 08:39 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com