Normalising the values using VBA (algorithm given)
Hello people,
I would like to normalize the values selected by the user.
Algorithm for it:
1. from the selected values of the user, find the largest value
2. for each selected cell value, divide that cells value by the maximum
value and muliply it by 10. for example, when written as a formula it
may be like this =10*B2/MAX($B$2:$BR$25); =10*D5/MAX($B$2:$BR$25);
=10*C3/MAX($B$2:$BR$25) etc...
3. Round the values.
VBA code that i currently use for rounding is
Dim Rng As Range
Set Rng = ActiveCell
Rng.Value = Application.WorksheetFunction. _
Round(Rng.Value, 0)
unfortunately this code roundly only one cell but not all the selected
cells. please rectify this issue too.
4. paste the resulting rounded values in a separate place in the same
worksheet. i.e not to overlap with the selected area.
ALL the FOUR steps come under the tag NORMALISING.
i have a command button called as "NORMALISE". i would like to know the
VBA code(that covers the four steps in the slgorithm) to be written in
the click event.
please help.
Thanks for all help to be rendered.
Regards,
Thulasiram.
|