Macro to hide all sheets in a list showing hide

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone

In sheet Control I have a List of all the sheets in my document
i want to hide some and show other tabs
In column A Range A2:A120 I have the sheets names
in Column B i have either "Hide" or Unhide

I need a macro that when run will Unhide all sheets then hide the ones marked as "Hide"

Please help if you can

Thanks
Tony
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
How about
VBA Code:
Sub tonywatson()
   Dim Cl As Range
   
   With Sheets("Control")
      For Each Cl In .Range("A2", .Range("A" & Rows.Count).End(xlUp))
         If Cl.Value <> "" Then
            If Evaluate("isref('" & Cl.Value & "'!A1)") Then
               Sheets(Cl.Value).Visible = Cl.Offset(, 1) <> "Hide"
            End If
         End If
      Next Cl
   End With
End Sub
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,433
Messages
6,124,861
Members
449,195
Latest member
MoonDancer

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top