I have a workbook with 8 different sheets that may or may not need to be printed on a daily basis. I want to set up a command that will print only the sheets that meet a certain criteria in another sheet. For example:

If A2 in sheet_1 = x, then sheet_2 = print;
If A3 in sheet_1 = [blank], then sheet_3 = do not print;
If A4 in sheet_1 = [blank], then sheet_4 = do not print;
If A5 in sheet_1 = [blank], then sheet_5 = do not print;
If A6 in sheet_1 = x, then sheet_6 = print;
If A7 in sheet_1 = x, then sheet_7 = print;
If A8 in sheet_1 = x, then sheet_8 = print;
and so on....


I am using following loop macro to print but am receiving a compile error at the start of the "IF" statement on the word "acell".


Dim y As Integer, acell As Range

y = 2
For Each acell In Range(A2:A9)
   If acell = x Then Worksheet("sheet_" & y).PrintOut Copies:=1, Collate:=True
   y = y + 1
Next
End Sub
the sheets I want to print are named sheet_2, sheet _3, and so on up to sheet_9

Any help is appreciated