Quote Originally Posted by RhinoBull
There are multiple ways of parsing so here one:
VB Code:
  1. Private Sub Command1_Click()
  2. Dim sText As String
  3. Dim res1$, res2$
  4.  
  5.     sText = "123456 - Popo"
  6.     res1 = Trim(Left(sText, InStr(1, sText, "-") - 1))
  7.     res2 = Trim(Mid(sText, InStr(1, sText, "-") + 1))
  8.    
  9.     Debug.Print res1
  10.     Debug.Print res2
  11.  
  12. End Sub
i got an error in this with this example string "123456 - Popo-Cost"
result1 = "123456 - Popo"
result2 = "Cost"

the result must be
result1 = "123456"
result2 = "Popo-Cost"

cheers