Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Need help with Text to Column in a macro.

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Need help with Text to Column in a macro.

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


"Viking" wrote:

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Need help with Text to Column in a macro.

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

Charlie wrote:
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


"Viking" wrote:

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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Need help with Text to Column in a macro.

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.

"Viking" wrote:

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

Charlie wrote:
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


"Viking" wrote:

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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
text column - via macro Rohit New Users to Excel 1 June 1st 10 01:13 PM
Macro for text to column Garrystone Excel Discussion (Misc queries) 5 February 3rd 08 02:33 PM
Text to column macro Anthony Excel Discussion (Misc queries) 2 December 5th 06 05:09 AM
Macro delimiting text if column has value Beverly76 Excel Programming 3 June 8th 06 11:41 PM
text to column macro hioncaffiene Excel Worksheet Functions 3 February 14th 06 02:09 PM


All times are GMT +1. The time now is 03:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"