First array value in Text2Col

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

First array value in Text2Col

Post by Rudi »

Hi,

Anyone know what the first value represents in the T2C array?
Selection.TextToColumns Destination:=Range("D1"), DataType:=xlDelimited, FieldInfo:=Array(1, 4)

I've experimented with it, changing it to 2 or 3 , etc.. and I don't see much change.
Any ideas?

TX
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
HansV
Administrator
Posts: 78369
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: First array value in Text2Col

Post by HansV »

For xlDelimited, the first value is the column number. For example, if you're going to split the data into 3 columns, you could use

..., FieldInfo:=Array(Array(1, xlTextFormat), Array(2, xlGeneralFormat), Array(3, xlDMYFormat))

to specify that the first column should be treated as text, that Excel may decide the format of the second column, and that the third column contains dates in DMY format.

For xlFixedWidth, the first position specifies the starting position within the text string.
Best wishes,
Hans

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: First array value in Text2Col

Post by Rudi »

Ah, that clarifies. TX.
I was using T2C to simply clean up text dates, so there was no "splitting" involved; hence the confusion.
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.