Search strings excel document VB

August 6, 2009 at 04:02:33
Specs: win xp 5.1.2600, 3mhz/2 gig
Hi, I would like a point in the right direction please.
My number in cell a1 will look similar to this 123/456/789.
It is 3 groups of 3 numbers seperated by '/'.
How do I get each group of 3 numbers as seperate strings?
Also, what is the search command to search an excel workbook for strings?
I will be assigning this code to a button.
Thank you.

See More: Search strings excel document VB

Report •

August 6, 2009 at 04:20:53
One option is to record a macro while you perform a Data...Text to Columns operation with the '/' as the delimiter:

Range("A1").TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
        :="/", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1)), _

Obviously this code could be cleaned up a little, but I think you get the idea.

Report •

August 6, 2009 at 05:47:15
I have cleaned it up a little.... it works.

It does exactly what I wanted. Thank you.

I may have further questions along the way. But I do try to figure things out as much as i can!

Report •

August 6, 2009 at 06:13:46
Glad I could help.

Report •

Related Solutions

Ask Question