VBA COde To Parse Text to Column trouble

atf32

Board Regular
Joined
Apr 13, 2011
Messages
157
Have code that parses the text in a cell to columns (see below) It works well when the text is in one continual string.
example:
"July","September","October","November"

But when the data has a crlf separating each item, it does not work right. In such case, I only get the first result of "July".
example:
"July"
"September"
"October"
"November"

My Parse code:

Selection.TextToColumns Destination:=Range("E11"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="""", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5 _
, 1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array( _
12, 1), Array(13, 1), Array(14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1), _
Array(19, 1), Array(20, 1), Array(21, 1), Array(22, 1), Array(23, 1), Array(24, 1), Array( _
25, 1), Array(26, 1), Array(27, 1), Array(28, 1), Array(29, 1), Array(30, 1), Array(31, 1)) _
, TrailingMinusNumbers:=True

What can I do to handle both situations?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
As the data is inconsistent I don't think it's possible to do with Text to Columns.
How many rows of data do you normally have?
Also what result do you want & where?
 
Upvote 0
My apologizes. This is for a work project, so I had to quickly come up with some dummy data. The actual data can include multiple sentences, that can include commas, dollar signs and/or other types of misc symbols. So perhaps my example was oversimplified. But I can tell you that in the first example, everything is begins and ends with a double quote. For the second example, the sentences start with a double quote and (i think) a quote and CRFL.
 
Upvote 0
In that case can you please supply some representative data and you expected outcome.
 
Upvote 0
Yeah, I get what you are saying. I can handle either way, but not both at the same time. No way of determining what I have. Really appreciate the effort.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,169
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top