I'm new to writing VBA code. I have been able to write the 2 codes below that do work if I only use one of the codes on a worksheet. I would like to combine the 2 codes on the same worksheet, but I have not figured out how to make them both work at the same time. Please help me in combining the 2 codes. Thanks for your help.
‘ First Code
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Or _
Target.Address <> Range("Type").Address Then Exit Sub
Sheets("AA").Select
ActiveSheet.Unprotect
Select Case LCase(Target)
Case Is = "fix": Sheets("AA").Range("e1").EntireColumn.Hidden = True
Case Is = "broken": Sheets("AA").Range("e1").EntireColumn.Hidden = False
ActiveSheet.Protect
End Select
Sheets("BB").Select
ActiveSheet.Unprotect
Select Case LCase(Target)
Case Is = "fix": Sheets("BB").Range("e1").EntireColumn.Hidden = True
Case Is = "broken": Sheets("BB").Range("e1").EntireColumn.Hidden = False
ActiveSheet.Protect
Sheets("Inputs").Select
Range("Type").Select
Exit Sub
End Select
Sheets("Inputs").Select
Range("Type").Select
End Sub
‘ Second Code
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Or _
Target.Address <> Range("Sequence").Address Then Exit Sub
Select Case LCase(Target)
Case Is = "none": Sheets("AA").Visible = True
Case Is <> "none": Sheets("AA").Visible = False
End Select
Select Case LCase(Target)
Case Is = "none": Sheets("BB").Visible = True
Case Is <> "none": Sheets("BB").Visible = False
Exit Sub
End Select
Sheets("Inputs").Select
Range("Sequence").Select
End Sub
Bookmarks