PDA

View Full Version : length of a minimum of a range defined by a variable



mshbhwn98
09-22-2014, 11:26 AM
Hi,

How to I find the length of a range that is defined by a variable? I am defining a range by looping through it and adding to it whenever the value is non-zero. So the range could end up being random cells down a column. I want to compare the length of the minimum value of that range and the length of the maximum value stored in the cells of that range but I am running into a few problems. Any help would be appreciated. I tried something like this...


Dim minimum as double

minimum = application.worksheetfunction.Min(xRng)
minLength = len(minimum)

but I keep getting 8 as that is the length of the double I guess?

Thanks

mancubus
09-23-2014, 12:16 AM
hi.
did you try Cstr?

like


Sub len_test()
Dim d As Double

d = 1212145879.21212
MsgBox Len(CStr(d))
End Sub



ps: keep in mind that it counts the decimal seperator as well.