[FONT="]I have the follow script in vba:[/FONT]
[FONT="]Sub ConditionalHide()
Dim cRange As String
cRange = Sheets(1).Range("H3")
For i = 2 To Sheets.Count
Sheets(i).Activate
If Range("H3").Value <> cRange Then
Sheets(i).Visible = False
Else: Sheets(i).Visible = True
End If
Next i
End Sub
The problem is that it gives me Expected error on Line 6. I am new to VBA and cannot make out whats wrong with my code. I am trying to Hide all the sheets that do not match the value in "H3" in Sheet 1.
[/FONT]
[FONT="]Sub ConditionalHide()
Dim cRange As String
cRange = Sheets(1).Range("H3")
For i = 2 To Sheets.Count
Sheets(i).Activate
If Range("H3").Value <> cRange Then
Sheets(i).Visible = False
Else: Sheets(i).Visible = True
End If
Next i
End Sub
The problem is that it gives me Expected error on Line 6. I am new to VBA and cannot make out whats wrong with my code. I am trying to Hide all the sheets that do not match the value in "H3" in Sheet 1.
[/FONT]