This will get everything to the left of the space:
Sub myTxt()
'Set the strings according to your post
myTxt1 = "2513,82 alpha"
myTxt2 = "999,71 somekindofexpression"
myTxt3 = "55,7 orange"
'Split the strings to an array using a space as the delimiter then assign the first element to the variable
myTxt1 = Split(myTxt1, " ")(0)
myTxt2 = Split(myTxt2, " ")(0)
myTxt3 = Split(myTxt3, " ")(0)
'Display the results
MsgBox "myTxt1 = " & myTxt1 & vbLf & "myTxt2 = " & myTxt2 & vbLf & "myTxt3 = " & myTxt3
End Sub
Change the 0 to a 1 to get the next set of data until another space is encountered. You can keep incrementing the number until it runs out of blocks of text. To find the maximum blocks use ubound(Split(myTxt1, " "))
If you have your heart set on using the left function, you can find the number char of the space using instr (In String):
instr(1,myTxt1," ")
You can then couple this with a left function like this:
Left(myText,instr(1,myTxt1," ")-1) 'Remove 1 to get rid of the space from the returned string
Lastly, you can use an array in here to allow for scalable amounts of input like so:
Sub myTxt2()
Dim myTxt As Variant, X As Long
'Input your data to an array (Comma seperate your values)
myTxt = Array("2513,82 alpha", "999,71 somekindofexpression", "55,7 orange")
'Loop through the array one element at a time
For X = LBound(myTxt) To UBound(myTxt)
'Replace the element with just the first chunk of the value
myTxt(X) = Split(myTxt(X), " ")(0)
Next
'Display results
MsgBox Join(myTxt, vbLf)
End Sub
Your data is still just as accessible, but instead of myTxt1, myTxt2, myTxt3, it would now be myTxt(1), myTxt(2), myTxt(3) respectively
Hope this helps you out now and in the future.