I found a function which seperates out numbers from letters. I
modified the formula to keep decimal points in. The formula works
well, however, the function came with a line that I don't understand.
The whole function is
------------------------------
Function ExtractDigits(cell As String) As Variant
'extract 1st continuous set of digits
'David McRitchie, 2001-09-26
Dim i As Long, flag As Long
flag = 0
ExtractDigits = ""
For i = 1 To Len(cell)
If Mid(cell, i, 1) >= "0" And _
Mid(cell, i, 1) <= "9" Or _
Mid(cell, i, 1) = "." Then
flag = 1
ExtractDigits = ExtractDigits & Mid(cell, i, 1)
'ExtractDigits = ExtractDigits * 1 'not sure what this does?
but 12.3=123 with on
Else
If flag = 1 Then Exit Function
End If
Next i
End Function
-----------------------------
I don't see what the purpose of the ExtractDigits = ExtractDigits * 1
is and I don't get what it is doing. If it is enabled, like it was in
the original formula, then if the cell is 12.3mg it returns 123 while
if it is disabled, then it returns 12.3. How is this line removing the
decimal point?
Thanks,
Andrew V. Romero
PS: Sorry if this message comes thru multiple times, Google groups
seems to be acting up.
Bookmarks