I want to hide sheets whose names are not present in a list.
I'm looking to replace the use of "Visible" with a reference to a list of cells in a worksheet named Visible.
I need to replace the "Visible" to a list of cells in Worksheet named Visible. The code should hide any sheets whose names are not found in this list.
Sub ocultarPlanilhas()
Dim ws As Worksheet
Sheets().Select
For Each ws In Worksheets
If ws.Name <> "Visible" Then
ws.Visible = xlSheetHidden
End If
Next ws
End Sub

sListwill be a string in the format /Sheet12/Sheet2/Sheet3/InStris used to comparews.namewithsList, and theMARKERis needed to prevent mismatching.e.g.
ws.Name = "Sheet1"InStr(1, sList, ws.Name, vbTextCompare)return 1 - it matchs a part ofSheet12InStr(1, sList, MARKER & ws.Name & MARKER, vbTextCompare)return 0 -/Sheet1/is not insList