ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro to hide/unhide WS based upon WS tab color (https://www.excelbanter.com/excel-discussion-misc-queries/261004-macro-hide-unhide-ws-based-upon-ws-tab-color.html)

Joe M.

Macro to hide/unhide WS based upon WS tab color
 
I have this macro to hide all WS that have red tabs. But it dosn't work. It
only hides one tab when there are many that are red. What is wrong?

Sub Hide_shts()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Tab.Color = 255 Then
ws.Visible = False
End If
Next
End Sub

Thanks,

Joe M.


Don Guillett[_2_]

Macro to hide/unhide WS based upon WS tab color
 

See your OTHER posts

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Joe M." wrote in message
...
I have this macro to hide all WS that have red tabs. But it dosn't work. It
only hides one tab when there are many that are red. What is wrong?

Sub Hide_shts()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Tab.Color = 255 Then
ws.Visible = False
End If
Next
End Sub

Thanks,

Joe M.




All times are GMT +1. The time now is 06:49 AM.

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