how do you get rid of the blank row?
Gord Dibben wrote:
Revised.................
02-Mar-09
Revised.................you do the math if number of rows per set is not
correct
Sub Move_Sets()
Dim iSource As Long
Dim iTarget As Long
iSource = 2
iTarget = 2
Range("A1:B1").Copy Range("C1:H1")
Do
Cells(iSource, "A").Resize(54, 2).Cut _
Destination:=Cells(iTarget, "A")
Cells(iSource + 54, "A").Resize(54, 2).Cut _
Destination:=Cells(iTarget, "C")
Cells(iSource + 108, "A").Resize(54, 2).Cut _
Destination:=Cells(iTarget, "E")
Cells(iSource + 162, "A").Resize(54, 2).Cut _
Destination:=Cells(iTarget, "G")
iSource = iSource + 216
iTarget = iTarget + 55 'insert a blank row
Loop Until IsEmpty(Cells(iSource, "A").Value)
End Sub
Gord
On Mon, 2 Mar 2009 10:57:03 -0800, AFSSkier
Previous Posts In This Thread:
Snaking columns in Excel
I wish to prepare a book inventory. Column A is the book title, Column B is
the author. I will sort alphabetically by column B (author), then
alphabetically by column A (books will be in alphabetical order for that
author). I wish to have a total of four columns on each page, so will add
Columns C and D. I want the first two columns to SNAKE to the third and
fourth columns. Then, continue in that same format to page 2. Can you help?
Re: Snaking columns in Excel
Hi
Select columns A
and goto Data > Sort > Set up the sort as desired.
Regards,
Per
After sorting the columns as you like.....................
After sorting the columns as you like.....................
Sub Move_Sets()
Dim iSource As Long
Dim iTarget As Long
iSource = 1
iTarget = 1
Do
Cells(iSource, "A").Resize(50, 2).Cut _
Destination:=Cells(iTarget, "A")
Cells(iSource + 50, "A").Resize(50, 2).Cut _
Destination:=Cells(iTarget, "C")
iSource = iSource + 100
iTarget = iTarget + 51
Loop Until IsEmpty(Cells(iSource, "A").Value)
End Sub
Gord Dibben MS Excel MVP
Gord,Your macro for snaking columns works great.
Gord,
Your macro for snaking columns works great. However, I need the column
headers in A1 & B1 repeated to C1 & D1 and throughout the spreadsheet.
Also have a different 2 column I need to snake to 8 columns (4 sets) in the
same manner. Each page is 54 rows at the page break.
--
Thanks, Kevin
:
Revised.................
Revised.................you do the math if number of rows per set is not
correct
Sub Move_Sets()
Dim iSource As Long
Dim iTarget As Long
iSource = 2
iTarget = 2
Range("A1:B1").Copy Range("C1:H1")
Do
Cells(iSource, "A").Resize(54, 2).Cut _
Destination:=Cells(iTarget, "A")
Cells(iSource + 54, "A").Resize(54, 2).Cut _
Destination:=Cells(iTarget, "C")
Cells(iSource + 108, "A").Resize(54, 2).Cut _
Destination:=Cells(iTarget, "E")
Cells(iSource + 162, "A").Resize(54, 2).Cut _
Destination:=Cells(iTarget, "G")
iSource = iSource + 216
iTarget = iTarget + 55 'insert a blank row
Loop Until IsEmpty(Cells(iSource, "A").Value)
End Sub
Gord
On Mon, 2 Mar 2009 10:57:03 -0800, AFSSkier
Re: Snaking columns in Excel
Assume, works great!
Thank you very much, Kevin
:
EggHeadCafe - Software Developer Portal of Choice
Seamless Data Compression in .NET
http://www.eggheadcafe.com/tutorial...d-f4d9eaf13469/seamless-data-compression.aspx