Splitting a table

  • Thread starter Thread starter Matthew
  • Start date Start date
M

Matthew

i have Imported a table. It is 2 Columns wide by 300 rows. Rather
than using up only half the printed page, I would like to have the list
side-by-side. So that it is easier to read, I wish I could have 1
table 2 columns by 150 rows and another table 2 columns by 150 rows.

(Assuming the page break is at 50 rows I would like the 1st 50 rows
left side pg, 1 2nd 50 right side pg 1, 3rd 50 left side pg 2, 4th 50th
right side pg 2, etc. . .)

Is there any way to do this without having to manually cut and paste?
 
Matthew

Try this macro.....the blank line between each set shows where to place the
pagebreaks. I did not include inserting pagebreaks in the code

Sub Set_Two_Times()
Dim iSource As Long
Dim iTarget As Long
Dim cCols As Long
Dim rrows As Long
iSource = 1
iTarget = 1
cCols = 2
rrows = 50
Do
Cells(iSource, "A").Resize(rrows, cCols) _
.Cut Destination:=Cells(iTarget, "A")
Cells(iSource + rrows, "A").Resize(rrows, cCols) _
.Cut Destination:=Cells(iTarget, (cCols + 1))
iSource = iSource + (rrows * cCols)
iTarget = iTarget + (rrows + 1)
Loop Until IsEmpty(Cells(iSource, "A").Value)
End Sub

If not familiar with macros, post back and I'll walk you through.


Gord Dibben MS Excel MVP
 
Gord

I frequently use macros. I like your macro than the one I thought I
would have to create. I completely understand it and appreciate it
 
Thanks for the feedback Matthew.

You got me thinking...why not add the code to insert the pagebreaks?

Will do that soon.


Gord
 

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

Back
Top