Maybe too simple...Table help

asdsparky

Board Regular
Joined
Oct 13, 2017
Messages
60
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".
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
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
A fellow had a somewhat similar situation at another forum a while back.
The solution there may be of interest to you, start about post # 33.
 
Upvote 0

Forum statistics

Threads
1,223,705
Messages
6,173,991
Members
452,541
Latest member
haasro02

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top