Printing issues

PMRetired2012

Board Regular
Joined
Aug 6, 2019
Messages
110
I have a code that i need to modify so that it wont print all 12 months.
The problem is i have data enterd into 8 months of this year but with the code i have it prints all 12 months even tho there isnt data in the last 3 months of the year.
Here is the code i have and it needs to be changed to where it only prints the pages that has something in cell A3 of each month and i want to print whole page. This code is attached to a userform that lets me select how and what i want printed.
CODE:
'AllMonthsPageOne
If OptionButton2 = True Then
Sheets(Array("JANUARY", "FEBUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER")).Select
Sheets("JANUARY").Activate
Range("A1:R54").Select

'PrintPreview
If CheckBox3.Value = True Then ExecuteExcel4Macro "PRINT(1,,,1,,TRUE,,,,,,1,,,TRUE,,FALSE)"

'Print
If CheckBox3.Value = False Then ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,1,,,TRUE,,FALSE)"

Thanks for any help!
 

Some videos you may like

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
3,955
You can start with this and add the necessary line/s of code to include the range to be printed :

VBA Code:
Option Explicit

Sub printout1()
Dim ws As Worksheet
    For Each ws In Worksheets
        If ws.Range("A3") <> "" Then
            ws.PrintOut
        End If
    Next ws
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,127,183
Messages
5,623,238
Members
415,957
Latest member
Newguy1924

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
Top