Hello!
How find witch position is "-" in text "30-0,55-16,5" in VBA!!
first i need only the first "-". Later the second "-" also
reason why i need this is dissever the text:
30
0,55
Hello!
How find witch position is "-" in text "30-0,55-16,5" in VBA!!
first i need only the first "-". Later the second "-" also
reason why i need this is dissever the text:
30
0,55
This will work for two. If you have more than two, you'll soon want a more elegant solution...
[vba] myString = "30-0,55-16,5"
firstPos = InStr(myString, "-")
secondPos = InStr(InStr(myString, "-") + 1, myString, "-")
[/vba]
thanks so fast answer
Without re-inventing the wheelOriginally Posted by BlueCactus
[VBA]
Sub GetValues()
Dim ary
Dim i As Long
ary = Split(ActiveCell.Value, "-")
For i = LBound(ary) To UBound(ary)
MsgBox ary(i)
Next i
End Sub
[/VBA]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber