A
Alex
I am new to VBA so knowledge is low.
I have a list of 10 numbers in range A1:A10. I want to
write VBA code so that if I select that range I get a
value returned (say in cell B1) that tells me the number
of rows beteeen the highest and lowest value. Thats it!
You can use Application.WorksheetFunction.Max(Selection)
to get the max value and do the same for the minimum
value.
From here I struggle. I can get VBA to recognise the max
and min values ( I used Debug.Print to see that I got the
correct values). But I need VBA to use the cell
references of the max and min to compute the row
difference. I can't see how to do this.
I have just spent 1.5 hours trying to work this out (on
top of 2.5 hours yesterday) so I think I now need help.
Many thanks to those who can offer help....
I have a list of 10 numbers in range A1:A10. I want to
write VBA code so that if I select that range I get a
value returned (say in cell B1) that tells me the number
of rows beteeen the highest and lowest value. Thats it!
You can use Application.WorksheetFunction.Max(Selection)
to get the max value and do the same for the minimum
value.
From here I struggle. I can get VBA to recognise the max
and min values ( I used Debug.Print to see that I got the
correct values). But I need VBA to use the cell
references of the max and min to compute the row
difference. I can't see how to do this.
I have just spent 1.5 hours trying to work this out (on
top of 2.5 hours yesterday) so I think I now need help.
Many thanks to those who can offer help....