Custom print macro

B

BOXMAN100

We have an Excel workbook that has 30 tabs in it. Depending on certai
conditions, we will not need to print every worksheet each time w
print. Need to define a macro that will look in a certain cell in eac
worksheet to determine if - it's "Y" go to the next worksheet, or i
it's "N", hide that worksheet. After the last worksheet, we will prin
entire workbook. After print, unhide all worksheets.

Thank you
 
T

Tom Ogilvy

for each sh in thisworkbook.Worksheets
if sh.Range("A1") = "N" then
sh.Visible = xlSheetHidden
end if
Next
ThisWorkbook.Printout
for each sh in thisworkbook.Worksheets
sh.Visible = xlSheetVisible
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top