J
jpzachar
Hello....I hope you can help....thanks in advance!
I have the following code. I want to add a feature to it so that when M12
equals "AR2" Sheet1 and Sheet 2 hide and Sheet 3 and Sheet4 unhide. And if
M12 does not equal "AR2 then Sheet1 and Sheet2 unhide and Sheet3 and Sheet4
hide. Is this possible?
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRange As Range
If Target.Count > 1 Then Exit Sub
Set myRange = Me.Range("M12")
If Intersect(Target, myRange) Is Nothing Then Exit Sub
If myRange.Value = "AR2" Then
On Error Resume Next
Me.Rows("60:87").EntireRow.Hidden = False
Me.Rows("88:109").EntireRow.Hidden = True
On Error GoTo 0
Else
On Error Resume Next
Me.Rows("88:109").EntireRow.Hidden = False
Me.Rows("60:87").EntireRow.Hidden = True
On Error GoTo 0
End If
End Sub
I have the following code. I want to add a feature to it so that when M12
equals "AR2" Sheet1 and Sheet 2 hide and Sheet 3 and Sheet4 unhide. And if
M12 does not equal "AR2 then Sheet1 and Sheet2 unhide and Sheet3 and Sheet4
hide. Is this possible?
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRange As Range
If Target.Count > 1 Then Exit Sub
Set myRange = Me.Range("M12")
If Intersect(Target, myRange) Is Nothing Then Exit Sub
If myRange.Value = "AR2" Then
On Error Resume Next
Me.Rows("60:87").EntireRow.Hidden = False
Me.Rows("88:109").EntireRow.Hidden = True
On Error GoTo 0
Else
On Error Resume Next
Me.Rows("88:109").EntireRow.Hidden = False
Me.Rows("60:87").EntireRow.Hidden = True
On Error GoTo 0
End If
End Sub