hello
I try making macro by hide specific sheets based on activate sheet. so if the sheet("data") is activate then just hide sh1,2,3 and show the rest of sheets sh4,5,6 and if the sheet("main") is activate then show sheets sh1,2,3 and hide sh4,5,6.
this is my trying but not work
I try making macro by hide specific sheets based on activate sheet. so if the sheet("data") is activate then just hide sh1,2,3 and show the rest of sheets sh4,5,6 and if the sheet("main") is activate then show sheets sh1,2,3 and hide sh4,5,6.
this is my trying but not work
VBA Code:
Sub vv()
Dim ws As Worksheet
Dim sh, sh1 As Variant
sh = Array("sh1", "sh2", "sh3")
sh1 = Array("sh4", "sh5", "sh6")
For Each ws In Worksheets
If Sheets("data").Activate Then
sh.Visible = False
End If
If Sheets("main").Activate Then
sh1.Visible = False
End If
Next ws
End Sub