Hi Guys,
I am a learner of VB with Excel.....
I try to get the individual scientific number from the string which has spaces....
I have attached the code which I tried.....
Say a string " 9 1.25 9.26e05 ", I am expecting to isolate the numbers as 9, 1.25, 9.26E05.
Indeed the code does isolate the numbers, but it does as four numbers as 9, 1.25, 9.26, 0E00 instead of getting 3 numbers....
Any help gents.....
kmothpur
I am a learner of VB with Excel.....
I try to get the individual scientific number from the string which has spaces....
I have attached the code which I tried.....
Say a string " 9 1.25 9.26e05 ", I am expecting to isolate the numbers as 9, 1.25, 9.26E05.
Indeed the code does isolate the numbers, but it does as four numbers as 9, 1.25, 9.26, 0E00 instead of getting 3 numbers....
Any help gents.....
kmothpur
Code:
Dim TestChar As String
Dim Col As Integer
Dim Numbs As String
TestChar =" 9 1.25 9.26e05 "
From = 1
Howmany = 1
WSCol = 1
For From = 1 To Len(TestChar)
C = Mid(TestChar, From, Howmany)
C1 = Mid(TestChar, From + 1, Howmany)
If IsNumeric(C) = True Or C = "." Or C = "e" Or C = "E" Then
Numbs = Numbs & C
If IsNumeric(C1) = False And C1 <> "." And C <> "e" And C <> "E" Then
Worksheets("Sheet1").Cells(2, WSCol) = Numbs
Numbs = 0
WSCol = WSCol + 1
End If
End If
Next From