Print Preview that allows users to select which pages should be printed?

memario1214

New Member
Joined
Nov 6, 2011
Messages
5
I have a bunch of different tables that get filtered and occasionally there will be a need for some of them to not be printed. I have set the page breaks so that they are each on one sheet. Is there a way for the users to be able to select which sheets print out using VBA?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Re: Print Preview that allows users to select which pages to print?

Set up a VBA code like this:

Code:
Sub printtest()
Selection.PrintOut Copies:=1
End Sub

Then all you need to do is highlight the range you want to print out and click run.
 
Upvote 0
Re: Print Preview that allows users to select which pages to print?

Set up a VBA code like this:

Code:
Sub printtest()
Selection.PrintOut Copies:=1
End Sub

Then all you need to do is highlight the range you want to print out and click run.

I want to make it as user friendly as possible. It is currently filtering a whole bunch of stuff and then printing it out. Some portions of data are empty, but have headers and such that aren't formatted. Could I maybe set up check boxes or something to have the VBA look at in determining which pages to print?
 
Upvote 0
Re: Print Preview that allows users to select which pages to print?

Hi,

not sure if this is what you want but....
I have used ActiveX Checkboxes on Sheet1 and changed the Captions in each of the Checkbox Properties to the Sheetnames present so I can use those directly in a sheet array. So the caption for Checkbox1 is Sheet1, Checkbox2, Sheet2 etc.


Code:
Sub PrintCheckedTabs()
Dim i As Integer
Dim Arr() As String
 
i = 0
    For Each Sh In ActiveSheet.Shapes
        If Sh.Type = msoOLEControlObject Then
 
            If TypeName(Sh.OLEFormat.Object.Object) = "CheckBox" Then
 
 
            If Sh.OLEFormat.Object.Object = True Then
 
 
            Nme = Sh.OLEFormat.Object.Object.Caption
 
           Select Case Nme
             Case Is = "Sheet1"
             Case Is = "Sheet2"
             Case Is = "Sheet3"
             Case Is = "Sheet4"
             Case Is = "Sheet5"
           End Select
 
            i = i + 1
             ReDim Preserve Arr(1 To i)
            Arr(i) = Nme
 
                End If
                End If
            End If
 
    Next Sh
 
 Worksheets(Arr).PrintOut
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,665
Messages
6,120,801
Members
448,992
Latest member
rohitsomani

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