Consulting

Results 1 to 2 of 2

Thread: set print area if needed over multiple pages

  1. #1
    VBAX Tutor
    Joined
    Jul 2010
    Posts
    225
    Location

    set print area if needed over multiple pages

    Hi, I have this code which works well to keep my print area to the range I want it. The only issue is when I keep adding rows it will confine it to 1 page and keep shrinking to fit.

    How do I adjust the code to keep same size but make it go over more pages if necessary, and if possible keep the title of the page which is in row 301?


    [VBA]Sub SetArea1()
    Dim LastCellRow
    LastCellRow = ActiveSheet.Range("b" & Range("ak301")).Row
    While Cells(LastCellRow, 24) = 0
    LastCellRow = LastCellRow - 1
    Wend
    ActiveSheet.PageSetup.PrintArea = Range("b301", Cells(LastCellRow, 24)).Address
    End Sub[/VBA]

  2. #2
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    Ride the wind to the sun
    Posts
    2,598
    hi.

    fit into one page wide and tall
    [VBA]
    Sub fit()

    With ActiveSheet.PageSetup
    .zoom = False
    .FitToPagesWide = 1
    .FitToPagesTall = 1
    End With

    End Sub
    [/VBA]

    zoom 100%
    [VBA]
    Sub zoom()

    With ActiveSheet.PageSetup
    .zoom = 100
    End With

    End Sub
    [/VBA]


    row num to repeat at top
    [VBA]Sub repattop()

    With ActiveSheet.PageSetup
    .PrintTitleRows = "$301:$301"
    End With

    End Sub
    [/VBA]
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •