• Copy a Wks Print Settings to Multiple Wks

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Copy a Wks Print Settings to Multiple Wks

    Author
    Topic
    #504168

    I would like to copy page and print setting from one worksheet to all other worksheets in my workbook. I can get most of the settings copied by by making the source the active sheet and then selecting all other sheets in the book. Then clicking Page Layout > Page Setup and press Enter seems to copy all the settings . . . except “Rows to repeat at top”.

    I’ve tried this VBA code, but it doesn’t assign the Rows 3 & 4 to repeat at the top of subsequent pages. What have I missed?

    Sub LoopThroughSheets2()
    Dim ws As Worksheet
    For Each ws In ActiveWorkbook.Worksheets

    With ActiveSheet.PageSetup
    .PrintTitleRows = “$3:$4”
    End With
    On Error Resume Next
    ws.Range(“A1”) = ws.Name

    Next ws
    End Sub

    Viewing 1 reply thread
    Author
    Replies
    • #1549145

      Hi

      You need to use your variable ws instead of ActiveSheet in your loop:

      Sub LoopThroughSheets2()
      Dim ws As Worksheet
      For Each ws In ActiveWorkbook.Worksheets

      With ws.PageSetup
      .PrintTitleRows = “$3:$4”
      End With
      On Error Resume Next
      ws.Range(“A1”) = ws.Name

      Next ws
      End Sub

      zeddy

    • #1549213

      Thanks Zeddy! That was the fix I needed.

    Viewing 1 reply thread
    Reply To: Copy a Wks Print Settings to Multiple Wks

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: