I have a string - with a name and a code - how can I extract just the name Eg:
Simon : 5353DF
should give 'Simon'
Debbie : 3535GH
should give 'Debbie'
Any ideas?
Simon
I have a string - with a name and a code - how can I extract just the name Eg:
Simon : 5353DF
should give 'Simon'
Debbie : 3535GH
should give 'Debbie'
Any ideas?
Simon
If you always use a colon as seperator, you can search for the first colon. eg
sName = "Simon : 5353DF "
MsgBox Trim(Left(sName, InStr(sName, ":") - 1))
Hi, Simon.
Try this code:
Dim str As String
Dim NewStr As String
str = "Simon : 5353DF"
NewStr = Mid(str, 1, InStr(1, str, ":") - 1)
MsgBox NewStr
Larisa