View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default VBA SPLIT FUNCTION

Hi
try
sub foo()
Dim str As String
v_str = "Duck, Donald - 8765"
MsgBox Left(v_str, InStr(v_str, ",") - 1)

end sub

--
Regards
Frank Kabel
Frankfurt, Germany


PCC wrote:
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"