ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Text To Columns Looping Macro (https://www.excelbanter.com/excel-programming/410021-text-columns-looping-macro.html)

Danny[_2_]

Text To Columns Looping Macro
 
I am using Excel 2003

I have the following code that loops through data in Cell A1

Selection.TextToColumns Destination:=Range("A1"),
DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(9, 1), Array(12, 1),
Array(22, 1), Array(25, 1)), _
TrailingMinusNumbers:=True
Selection.Cut
Range("A4").Select
ActiveSheet.Paste
Range("C1").Select
Selection.Cut
Range("A5").Select
ActiveSheet.Paste
Range("E1").Select
Selection.Cut
Range("A6").Select

From above the code goes through each array and parses it out in this
case to Cell E1. I would like to know how I can use a loop to do the
above sequence. 9 values then 3 then 9 values then 3 etc....

The second part is copying and pasting every other cell from the above
loop Which is copy Cell A1 paste to A4 then copy C1 and paste to A5
etc... until the data ends.

So is I would guess it would be a loop within a loop but am unsure how
to code this.

Thanks
D



All times are GMT +1. The time now is 06:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com