Need help with Text to Column in a macro.

V

Viking

I am hoping that someone can offer help with this matter.

I have the following text that I need to break into separate columns to
get the sentences separated:
"1.2.3 This is an example. That I need to break down"

What I get when I do a texttocolumn using the "." as the separator:
"1" "2" "3" "This is an example" "That I need to
break down"

What I am trying to get is:
"1.2.3" "This is an example" "That I need to break down"

Is there someway of breaking the "1.2.3" out first?

Thanks for any help.
Troy Vincent
 
G

Guest

Dim s As String
Dim FirstPart As String
Dim OtherParts() As String

s = "1.2.3 This is an example. That I need to break down"
FirstPart = Split(s, " ", 2)(0)
OtherParts = Split(Split(s, " ", 2)(1), ".")

FirstPart returns a single string
OtherParts returns a (zero-based) array
 
V

Viking

Charlie

That worked great for the most part. When I ran a test to the text
that I am working with I found that the following happened.

when the numbers changed to something like "1.4.0 This is an example.
That I need to break down"

I get "1.4" "This is an example" "That I need to break down"

It is droping the .0
Any Ideas on how I would be able to keep it.
Thanks in advance
Troy Vincent
 
G

Guest

That's unusual. Could you post the exact code and data you are using? I
will be hitting the road shortly but someone else may be able to figure it
out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top