Checking the Code

PMRetired2012

Board Regular
Joined
Aug 6, 2019
Messages
123
What im wondering is there a way to shorten the code for these lines of code that i have written and get the same outcome. What i want to do is only print pages that have something in cell A3 and S3 and then i want it to print both pages. Here is the code i have writen>

If OptionButton2 = True Then

Dim A As Integer
A = 1
For A = 1 To 12
Sheets(A).Select
If WorksheetFunction.CountA(ActiveSheet.Range("A3:A54")) <> 0 Then
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)"
Else
A = A + 1
End If
Next A



If CheckBox1.Value = True Then

Dim B As Integer
B = 1
For B = 1 To 12
Sheets(B).Select
If WorksheetFunction.CountA(ActiveSheet.Range("S3:S54")) <> 0 Then
Range("S1:AL54").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)"
Else
B = B + 1
End If
Next B
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
The link you provided only takes me to the Main Login Window for Dropbox ... it does not provide the download link.
 
Upvote 0
You would download it like any other file off the internet. Then open the workbook in Excel.

My download files end up in my DOWNLOAD folder. I then double click the file and they open.
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,428
Members
449,083
Latest member
Ava19

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