I have a table consisting of 3 columns. I need the table to "wrap" on one page until there is no more room on that page before it continues to the next page. When I sort, I need the table to sort in the same format (left to right on page 1 then 2, etc.) Just trying to consolidate space when printing while also allowing me to sort or insert data without having to restructure the whole sheet.
I did try the following code to see if I could format the 3 tables per page after all info is input and sorted before I print, but got a "Compile Error: Sub or Function not defined".
I did try the following code to see if I could format the 3 tables per page after all info is input and sorted before I print, but got a "Compile Error: Sub or Function not defined".
Code:
Private Sub CommandButton1_Click()
Dim r As Range
Dim nRows As Long
Range("A1:C1").Copy
Range("D1").PasteSpecial
Range("G1").PasteSpecial
nRows = 40
Set r = Range(Cells(1, 1), Cells(nRows + 1, 3))
Application.ScreenUpdating = False
While r.Cells(1, 1) <> ""
r.Offset(nRows, 0).Copy r.Cells(1, 4)
r.Offset(nRows * 1, 0).Copy r.Cells(1, 7)
r.Offset(nRows * 1, 0).Delete Shift:=xlUp
r.Offset(nRows, 0).Delete Shift:=xlUp
Set r = r.Offset(nRows, 0)
Wend
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub