destination in text to column

mrinal saha

Board Regular
Joined
Jan 20, 2009
Messages
229
Hi,

In below code, i have given the destination = range(b2). But everytime I run the code either the data splits and get pasted in b3 or b4, but not in b2. Any specific reason for this..

Columns("A:A").Select
Selection.TextToColumns Destination:=Range("b2"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(12, 1), Array(20, 1), Array(28, 1), Array(40, 1), _
Array(51, 1), Array(115, 1), Array(147, 1), Array(179, 1)), TrailingMinusNumbers:= _
True
Columns("A:A").Delete

thanks,
Mrinal
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Can you post a representative sample of the cells you are splitting using this functionality?
 
Upvote 0
example

column A contains the below info

<TABLE style="WIDTH: 1302pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=1736 border=0><COLGROUP><COL style="WIDTH: 1302pt; mso-width-source: userset; mso-width-alt: 63488" width=1736><TBODY><TR style="HEIGHT: 13.5pt" height=18><TD class=xl65 style="BORDER-RIGHT: black 0.5pt solid; BORDER-TOP: black 0.5pt solid; BORDER-LEFT: black 0.5pt solid; WIDTH: 1302pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 13.5pt; BACKGROUND-COLOR: white" width=1736 height=18>PDBD420P-R01 PRODUCT & PRICING DATE 07/26/11 </TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD class=xl67 style="BORDER-RIGHT: black 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 13.5pt; BACKGROUND-COLOR: white" height=18> SECURITY SETUP AUTOMATION - DAILY SETUPS (DEBT SECURITIES) PAGE 1 </TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD class=xl67 style="BORDER-RIGHT: black 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 13.5pt; BACKGROUND-COLOR: white" height=18> </TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD class=xl67 style="BORDER-RIGHT: black 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 13.5pt; BACKGROUND-COLOR: white" height=18> CUSIP SEC # PROD.C SEC.SYMBOL MRKT NAME SIRS ISSUER NAME DESCRIPTION LINE 1 DESCRIPTION LINE 2 DESCRIPTION LINE 3 </TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD class=xl66 style="BORDER-RIGHT: black 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 13.5pt; BACKGROUND-COLOR: #ccffcc" height=18> --------- ------ ------ ---------- --------- -------------------------------------------------------------- ------------------------------ ------------------------------ ------------------------------</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD class=xl66 style="BORDER-RIGHT: black 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 13.5pt; BACKGROUND-COLOR: #ccffcc" height=18> 02000000 N00000 xxx xxx xX abc BANK abc BANK UT ind RT 00.1000% MAT 02/04/13 FIXED RATE CD </TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD class=xl66 style="BORDER-RIGHT: black 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 13.5pt; BACKGROUND-COLOR: #ccffcc" height=18> 02000000 N00000 xxx xxx xX abc BANK abc BANK UT ind RT 00.1000% MAT 02/04/13 FIXED RATE CD </TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD class=xl66 style="BORDER-RIGHT: black 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 13.5pt; BACKGROUND-COLOR: #ccffcc" height=18> 02000000 N00000 xxx xxx xX abc BANK abc BANK UT ind RT 00.1000% MAT 02/04/13 FIXED RATE CD </TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD class=xl66 style="BORDER-RIGHT: black 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 13.5pt; BACKGROUND-COLOR: #ccffcc" height=18> 02000000 N00000 xxx xxx xX abc BANK abc BANK UT ind RT 00.1000% MAT 02/04/13 FIXED RATE CD </TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD class=xl66 style="BORDER-RIGHT: black 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 13.5pt; BACKGROUND-COLOR: #ccffcc" height=18> 02000000 N00000 xxx xxx xX abc BANK abc BANK UT ind RT 00.1000% MAT 02/04/13 FIXED RATE CD </TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD class=xl66 style="BORDER-RIGHT: black 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 13.5pt; BACKGROUND-COLOR: #ccffcc" height=18> 02000000 N00000 xxx xxx xX abc BANK abc BANK UT ind RT 00.1000% MAT 02/04/13 FIXED RATE CD </TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD class=xl66 style="BORDER-RIGHT: black 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 13.5pt; BACKGROUND-COLOR: #ccffcc" height=18> 02000000 N00000 xxx xxx xX abc BANK abc BANK UT ind RT 00.1000% MAT 02/04/13 FIXED RATE CD </TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD class=xl66 style="BORDER-RIGHT: black 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 13.5pt; BACKGROUND-COLOR: #ccffcc" height=18> 02000000 N00000 xxx xxx xX abc BANK abc BANK UT ind RT 00.1000% MAT 02/04/13 FIXED RATE CD </TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD class=xl66 style="BORDER-RIGHT: black 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 13.5pt; BACKGROUND-COLOR: #ccffcc" height=18> 02000000 N00000 xxx xxx xX abc BANK abc BANK UT ind RT 00.1000% MAT 02/04/13 FIXED RATE CD </TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD class=xl66 style="BORDER-RIGHT: black 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 13.5pt; BACKGROUND-COLOR: #ccffcc" height=18> 02000000 N00000 xxx xxx xX abc BANK abc BANK UT ind RT 00.1000% MAT 02/04/13 FIXED RATE CD </TD></TR></TBODY></TABLE>


thanks,
Mrinal
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

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