View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_3_] Dana DeLouis[_3_] is offline
external usenet poster
 
Posts: 690
Default VBA SPLIT FUNCTION

If you wish to use the Split function, here is one way...

Sub Demo()
Dim s As String
s = "Duck, Donald - 8765"
Debug.Print Split(s, ",")(0)

s = "Mouse, Mickey - 3456"
Debug.Print Split(s, ",")(0)
End Sub

returns:
Duck
Mouse

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"PCC" wrote in message
...
I need to get the left portion of a variable length string
up to the comma delimiter. I tried the Split function but
apparently I'm not getting it right.
For Example:

Ex1:
The string: "Duck, Donald - 8765"
I want to get "Duck"

Ex2:
The String: "Mouse, Mickey - 3456"
I want to get "Mouse"