unknownymous
Board Regular
- Joined
- Sep 19, 2017
- Messages
- 249
- Office Version
- 2016
- Platform
- Windows
Hello Gurus,
I am trying to create a macro where in if the cell value in the MAIN sheet matches one with the hidden sheet name, macro will unhide it.
By the way, those Data x Sheetswhere hidden because there's too many.
Example: In the MAIN sheet, if cell Value in A1 is "DATA 1" then it should unhide the tab with sheet name as "DATA 1"
' = = = This one is not working
Sub UnhideSheet()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Sheets
If sh.Name <> "MAIN" Then
If sh.Range("A1").Value = "DATA 1" Then sh.Visible = True
If sh.Range("A1").Value = "DATA 2" Then sh.Visible = True
If sh.Range("A1").Value = "DATA 3" Then sh.Visible = True
'Add more
'Add more
'Add more
End If
Next sh
End Sub
= = = =
Appreciate the help.
I am trying to create a macro where in if the cell value in the MAIN sheet matches one with the hidden sheet name, macro will unhide it.
By the way, those Data x Sheetswhere hidden because there's too many.
Example: In the MAIN sheet, if cell Value in A1 is "DATA 1" then it should unhide the tab with sheet name as "DATA 1"
' = = = This one is not working
Sub UnhideSheet()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Sheets
If sh.Name <> "MAIN" Then
If sh.Range("A1").Value = "DATA 1" Then sh.Visible = True
If sh.Range("A1").Value = "DATA 2" Then sh.Visible = True
If sh.Range("A1").Value = "DATA 3" Then sh.Visible = True
'Add more
'Add more
'Add more
End If
Next sh
End Sub
= = = =
Appreciate the help.