Johnny Thunder
Well-known Member
- Joined
- Apr 9, 2010
- Messages
- 693
- Office Version
- 2016
- Platform
- MacOS
Hi group,
So I have two Worksheet_Change Events written out but I realized today that you can only have one per page so here is the code, can anyone suggest a revision to combine the two into one so that I can wrap up this project?
So I have two Worksheet_Change Events written out but I realized today that you can only have one per page so here is the code, can anyone suggest a revision to combine the two into one so that I can wrap up this project?
Code:
----------------------------------------------------------------------------------------------------------------------
'--- Hide Rows based on target value description
'----------------------------------------------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Pass As String
Pass = "password"
If Target.Address = "$C$9" Then
ActiveSheet.Unprotect Pass
If Target <> "Management" Then
Range("34:37").EntireRow.Hidden = True
Else
Range("34:37").EntireRow.Hidden = False
End If
End If
ActiveSheet.Protect Pass
End Sub
'----------------------------------------------------------------------------------------------------------------------
'--- Run specific code based on two cell value
'----------------------------------------------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$16" Then 'Need this line to also include the C16
If Target <> vbNullString And Range("C11").Value = "Edit Entry" Then
Call PopulateEntry
ElseIf Target <> vbNullString And Range("C11").Value = "Deactivate" Then
Call PopulateEntry
End If
End If
End Sub