ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loop to hide sheet based on cell (https://www.excelbanter.com/excel-programming/445024-loop-hide-sheet-based-cell.html)

Norvascom

Loop to hide sheet based on cell
 
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

isabelle

Loop to hide sheet based on cell
 
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 :
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



All times are GMT +1. The time now is 08:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com