Loop to hide sheet based on cell

  • Thread starter Thread starter Norvascom
  • Start date Start date
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
 
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 :
 
Back
Top