Printing Sheets 01 - 31

marimar02

Board Regular
Joined
May 21, 2010
Messages
128
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am hoping for some expert help please.

I have a following code:

Code:
Private Sub CommandButton1_Click()
Dim oSheet As Worksheet
    Application.ScreenUpdating = False
 
    Set oSheet = ActiveSheet
 
    Worksheets("Report").Select
    ExecuteExcel4Macro "PRINT()"
 
    Application.ScreenUpdating = True
    oSheet.Select
    Set oSheet = Nothing
 
    Unload Me
 
End Sub

I would like to insert a loop which would allow me to print sheets named 01 - 31 corresponding to start date in cell F4 and running the loop 13 times to get two weeks worth of reports. Basically, my worksheet Report is summary of 14 different pages which I would like to print along with the report as backup. Since the date changes, I'd like macro to select only those sheets that are relevant. There is one catch that i'm having trouble with... the report sometimes starts with last months date or ends with next months date. I need the loop to recognize these and omit from printing.

Thank you so much for your help...
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,224,550
Messages
6,179,463
Members
452,915
Latest member
hannnahheileen

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