Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then
Exit Sub 'single cell at a time
End If
If Not (Intersect(Target, Me.Range("b3")) Is Nothing) Then
'changing B3
Me.Rows.Hidden = False
Select Case LCase(Target.Value)
Case Is = LCase("New")
Me.Range("a2").Resize(12).EntireRow.Hidden = True
Case Is = LCase("Amendment")
Me.Range("a22").Resize(7).EntireRow.Hidden = True
Case Is = LCase("Update")
Me.Range("a22").Resize(7).EntireRow.Hidden = True
End Select
ElseIf Not (Intersect(Target, Me.Range("e3")) Is Nothing) Then
'changing e3
'your code that does other stuff here
'if you're changing another cell
'do this surrounding the change
Application.EnableEvents = False
Me.Range("F3").Value = "changed to something else"
Application.EnableEvents = True
'to stop your change via code from firing this event
End If
End Sub
I've solved part a) of my follow-up query, however I can't get part b) to
work i.e. how can I replicate the row unhide for a value for a secondary drop
down in the macro.
To reply to your questions (in reverse order)
Excel 2003 (SP3)
Cell B3 is validated through data validation with a source = changetype
which is a list held on a separate sheet containing the values (New,
Amendment and Update)
Cell E3 is validated through data validation with a source = system which is
a list held on a separate sheet containing the values (Systema, Systemb,
Systemc)