Conditional Print Macro II

newclasshero

New Member
Joined
Sep 1, 2006
Messages
46
So my first question was answered about Conditional Printing. I decided that I would like to take it to the next step and nest another IF into the macro. However it seems that it still prints runs the first 2 macros and not just the single macro that fits the condition. Please tell me what I am doing wrong.


Sub Print_All()
'
' Print_All Macro
' Prints all necessary pages of IVIS.
'
' Keyboard Shortcut: Ctrl+Shift+P
'
If Sheets("V I S").Range("G4") = "BRIAN" Then

Sheets("Endsheet").PrintOut From:=1, To:=1
Sheets("V I S").PrintOut From:=1, To:=1
Sheets("FAX Currency-Tag").PrintOut From:=1, To:=3
Sheets("FAX C.B. - OCI").PrintOut From:=1, To:=1
Sheets("Fax Dealer").PrintOut From:=1, To:=2
Sheets("FAX C.B. - OCI").PrintOut From:=5, To:=5
Sheets("Endsheet").PrintOut From:=5, To:=6
Sheets("Endsheet").PrintOut From:=8, To:=9
Sheets("Fax Dealer").PrintOut From:=4, To:=4
Sheets("Fax Dealer").PrintOut From:=3, To:=3
Sheets("FAX C.B. - OCI").PrintOut From:=3, To:=3
Sheets("FAX Currency-Tag").PrintOut From:=4, To:=4

If Sheets("V I S").Range("G4") = "EXECUTIVE" Then
Sheets("Endsheet").PrintOut From:=1, To:=1
Sheets("V I S").PrintOut From:=1, To:=1
Sheets("FAX Currency-Tag").PrintOut From:=1, To:=3
Sheets("FAX C.B. - OCI").PrintOut From:=5, To:=5
Sheets("Endsheet").PrintOut From:=5, To:=6
Sheets("Fax Dealer").PrintOut From:=4, To:=4
Sheets("Fax Dealer").PrintOut From:=3, To:=3
Sheets("FAX C.B. - OCI").PrintOut From:=3, To:=3
Sheets("FAX Currency-Tag").PrintOut From:=4, To:=4

Else
Sheets("Endsheet").PrintOut From:=1, To:=1
Sheets("V I S").PrintOut From:=1, To:=1
Sheets("FAX Currency-Tag").PrintOut From:=1, To:=3
Sheets("FAX C.B. - OCI").PrintOut From:=1, To:=1
Sheets("Fax Dealer").PrintOut From:=1, To:=2
Sheets("FAX C.B. - OCI").PrintOut From:=5, To:=5
Sheets("Endsheet").PrintOut From:=5, To:=6
Sheets("Fax Dealer").PrintOut From:=4, To:=4
Sheets("Fax Dealer").PrintOut From:=3, To:=3
Sheets("FAX C.B. - OCI").PrintOut From:=3, To:=3
Sheets("FAX Currency-Tag").PrintOut From:=4, To:=4
End If
End If
End Sub
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
To add to this if the is nothing in cell G4 then it comes up with error message: Block If without End If. I know that sounds simple but I am new an cannot figure it out.
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,317
Members
449,081
Latest member
tanurai

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