View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Andrew[_56_] Andrew[_56_] is offline
external usenet poster
 
Posts: 130
Default Separating parts of a string in VBA

On Mar 31, 6:03*pm, "ozgrid.com" wrote:
In B1 (format as date) and copied down;
=--TRIM(MID(A1,FIND(" ",A1),8))
In C1 (format as date) and copied down;
=--TRIM(MID(A1,FIND("THRU",A1)+5,256))

In VBA replace FIND for Instr function.

I would use EditReplace and replace "DATE" with nothing and "THRU" with
nothing then use Text to columns to split the 2 dates.

--
Regards
Dave Hawleywww.ozgrid.com

"Andrew" wrote in message

...

Hello,
I have a string in cells(1,1). *The value of the cell is "DATE" 1/1/10
THRU 3/1/10" *I want to separate this string into the two new strings
such that one string would read "1/10/10" and the other would read
"3/1/10". *In C programming, this would be fairly easy. *But in VBA I
don't know any string functions which can read and compare individual
characters. *Does anyone know how to accomplish what I am trying to
do?


thanks


Thanks. Both of these work fine.