Excel Macro print button

Paulyw

New Member
Joined
Jan 7, 2015
Messages
1
Hi guys, pretty new to excel and really appreciate any help/advise offered.

I have a workbook with 30 worksheets referencing off a master(worksheet) for some of there data.
I would like to tick a checkbox on the master(worksheet) push my print button and have all of the selected checkboxes print to PDF...
suggestions?

Thanks!
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I did the following code on a test workbook and was able to print any sheet with a marked checkbox.
Code:
Sub SelectivePrint()
Dim i As Integer
For i = 1 To Sheets.Count
    On Error Resume Next
    If Sheets(i).PrintBox = True Then Sheets(i).PrintOut
Next i
End Sub
In order for code to work, you would need an ActiveX checkbox labeled "PrintBox" on each sheet you would want to have the print option.

Once complete, you could insert a Beveled box and add the macro to it (which would trigger the macro to run on click)
 
Last edited:
Upvote 0
Not sure if this is much help to you, worth a try. I never really got in well with Excel and PDFs they seem to scatter on save, unlike M$ Word

To save a lot of code this will run and save each sheet as a PDF, just delete what You do not want. The code will take a bit of time to run, You will see the creation bar lane moving each with thou

The files are save default local(Documents / my Documents etc

jiuk

Code:
Sub my_SaveAS_PDFs()
    Dim myWORKSHEET As Worksheet
    Dim myFILE_NAME As String
    For Each myWORKSHEET In ActiveWorkbook.Worksheets
        On Error Resume Next
       
        myFILE_NAME = ActiveWorkbook.Name & "-" & myWORKSHEET.Name
        
            myWORKSHEET.ExportAsFixedFormat _
            Type:=xlTypePDF, _
            Filename:=myFILE_NAME, _
            Quality:=xlQualityStandard, _
            IncludeDocProperties:=True, _
            IgnorePrintAreas:=False
    Next myWORKSHEET
        On Error GoTo zero
Exit Sub
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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