Can an active page be deactivated?

Russk68

Well-known Member
Joined
May 1, 2006
Messages
589
Office Version
  1. 365
Platform
  1. MacOS
Hi all!
In a worksheet where there are several pages active in Page Break View, is it possible to deactivate any of them even though there is information on them?

Thank you!

Russ
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Select the area you want to have printed and use Set Print Area in Page Layout tab.
The other option is to use the blue borders in Page break preview to surround the printed area needed. One restriction is the the Print Area must consist of contiguous areas and be rectangular.

The other way to skip unneeded pages is to type the numbers of the ones to be printed in the print dialog.
 
Upvote 0
Hi Bobsan
I should have been more specific.
I want to automate the process for pages to be deactivated. Or even rows.
For an example: If A30="Deactivate" then anything below row 30 will not be printed.

Thanks!
 
Upvote 0
try this:
Code:
Sub Deactivator()
    On Error Resume Next
    Const Str1 = "Deactivate"
    Dim strPA As String
    Dim rng As Range, rngPA As Range
    With ActiveSheet
        strPA = .PageSetup.PrintArea
        If strPA = "" Then
            If vbYes = MsgBox("No Print Area is defined. Set it to UsedRange?", vbYesNo) Then
                strPA = .UsedRange.Address
                .PageSetup.PrintArea = strPA
            Else
                GoTo EP
            End If
        End If
        Set rngPA = .Range(strPA)
        Set rng = .Range("A:A").Find(Str1)
        If rng Is Nothing Then MsgBox "No " & Str1 & " lines found.": GoTo EP
        If rng.Row <= rngPA.Row Then
            .PageSetup.PrintArea = ""
            MsgBox "Print Area is cleared."
            GoTo EP
        End If
        Set rngPA = rngPA.Resize(rng.Row - rngPA.Row)
        .PageSetup.PrintArea = rngPA.Address
    End With
EP:
    Set rng = Nothing
    Set rngPA = Nothing
End Sub
untested
 
Upvote 0
Of course this can be made to loop through all sheets of the workbook.
But needs some small adjustments. First see if this does what you need the way you need it.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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