Loop to hide sheet based on cell

N

Norvascom

Hi,

I am trying to create a simple loop to hide worksheets in my workbook
based on value reported on a specific cell on each worksheet.
If value on cell B8 on the worksheet is equal to "No Data", hide this
worksheet. If not, keep visible. Then go to the next worksheet.

Thanks for your help
 
I

isabelle

hi,

On Error Resume Next
For Each oSheet In Worksheets
If oSheet.Range("B8") = "No Data" Then
oSheet.Visible = False
If Err.Number <> 0 Then Err.Clear: Exit Sub
Else
oSheet.Visible = True
End If
Next



--
isabelle



Le 2011-10-06 10:35, Norvascom a écrit :
 

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