Help with print marco

AC

Board Regular
Joined
Mar 21, 2002
Messages
153
The Marco below will print out sheets even if there is not a match to the criteria, is there anyway to change that, in column G, I have the formula =IF(ISNA(VLOOKUP(B10,building_list,2,FALSE)),"",VLOOKUP(B10,building_list,2,FALSE)), down to row 500, is it because of this it is printing a lot of sheets? Thanks, using Excel ‘97

Code:
Private Sub Print_Macro()
Application.ScreenUpdating = False
Sheets("workorders").Select
            Selection.AutoFilter Field:=5, Criteria1:="72"
    Selection.AutoFilter Field:=6, Criteria1:="="
    ActiveSheet.PageSetup.PrintArea = "$A:$G"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
    
            Selection.AutoFilter Field:=5, Criteria1:="73"
    Selection.AutoFilter Field:=6, Criteria1:="="
    ActiveSheet.PageSetup.PrintArea = "$A:$G"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
    
    
        Selection.AutoFilter Field:=5, Criteria1:="74"
    Selection.AutoFilter Field:=6, Criteria1:="="
    ActiveSheet.PageSetup.PrintArea = "$A:$G"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
        

    ActiveSheet.PageSetup.PrintArea = ""
    Selection.AutoFilter Field:=5
    Selection.AutoFilter Field:=6
    Range("A1").Select
    Selection.End(xlDown).Select
    ActiveCell.Offset(1, 0).Select
Application.ScreenUpdating = True
    End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,225,061
Messages
6,182,624
Members
453,127
Latest member
IMagill

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