I have a user-input sheet created with one cell set to control which image is displayed to the right of the table. To accomplish this, I simply stacked all the images and have a macro written to bring the appropriate image to the front.
This works fine if I modify the trigger cell, but as soon as I change another input and then go back and modify the trigger cell again, nothing happens. Can someone please help me figure out why? The code is as follows:
This works fine if I modify the trigger cell, but as soon as I change another input and then go back and modify the trigger cell again, nothing happens. Can someone please help me figure out why? The code is as follows:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Variables
Dim Old_ScrUpdate As Boolean
Dim KeyCell1 As Range
Set KeyCell1 = [C24]
'Prevent screen flicker
Old_ScrUpdate = Application.ScreenUpdating
Application.ScreenUpdating = False
Application.EnableEvents = False
'If cells other than C24 are changed, do nothing
If Not Application.Intersect(KeyCell1, Range(Target.Address)) _
Is Nothing Then
If [C24] = "0" Then
Shapes("Case0Iso").ZOrder msoBringToFront
Shapes("Case0Top").ZOrder msoBringToFront
End If
If [C24] = "1" Then
Shapes("Case1Iso").ZOrder msoBringToFront
Shapes("Case1Top").ZOrder msoBringToFront
End If
If [C24] = "2" Then
Shapes("Case2Iso").ZOrder msoBringToFront
Shapes("Case2Top").ZOrder msoBringToFront
End If
'Only show user inputs in rows 35/36 if config is type 3
If [C24] = "3" Then
'Sheet1.Unprotect
Rows("35:36").Hidden = False
Shapes("Case3Iso").ZOrder msoBringToFront
Shapes("Case3Top").ZOrder msoBringToFront
'Sheet1.Protect
Else
'Sheet1.Unprotect
Rows("35:36").Hidden = True
'Sheet1.Protect
End If
Application.ScreenUpdating = Old_ScrUpdate
Application.EnableEvents = True
End If
End Sub