Printing issues

PMRetired2012

Board Regular
Joined
Aug 6, 2019
Messages
123
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!
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
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
 
Upvote 0

Forum statistics

Threads
1,213,544
Messages
6,114,249
Members
448,556
Latest member
peterhess2002

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