I am trying to make the visibility property (True or false) as a variable based on the selection of a value in the VBA. But it is giving me an error. Is that not possible?
Please help...
PHP Code:
Sub Worksheet_Change(ByVal Target As Range) Dim Selection As String 'List of checklists below Checklists = Array("ABC", "DEF", "XYZ")
If Target.Row = 7 And Target.Column = 13 Then 'To activate the macro only when the dropdown selection changes
Dim sirt As String sirt = True
For Each ShtName In Checklists Worksheets(ShtName).Visible = False Next ShtName
Selection = Range("M7").Value
If Selection = "Show All" Then 'To show all checklist with Show all is selected
For Each ShtName In Checklists Worksheets(ShtName).Visible = True Next ShtName
ElseIf Selection <> "None" Then
Worksheets(Selection).Visible = sirt
End If
End If
End Sub
Getting error on
PHP Code:
Worksheets(Selection).Visible = sirt
Please make the Post as solved, when you get your answer & Click * if you like my suggestion
Bookmarks