move multiple columns into single set of columns

G

Guest

Excel move multiple columns into single set of column
How can I automate this
I have a huge sheet

A B C D E F G H I --- ZZ
R1
R2
R3
RN

and I want to move every block of 4 columns(or n cols) to sit under A -D

so

R1 A B C D
R2
R3
R4
R5 E F G H
R6
R7
R8
R9
R10 I J K L

etc
 
G

Guest

You have to do it with a very simple macro

Sub test()

Lastrow = Rows.Count

For RowCount = 1 To Lastrow

Set firstcell = Cells(RowCount, "E"). _
End(xlToRight)

If Not IsEmpty(firstcell) Then
Set cutrange = Range(firstcell, _
firstcell.Offset(rowoffset:=0, _
columnoffset:=3))
cutrange.Cut _
Destination:=Range("A" & RowCount)
End If

Next RowCount

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top