no_skill_model_builder
New Member
- Joined
- Jan 6, 2014
- Messages
- 2
Hello Forum! I'm struggling with a macro issue and am hoping to find insight from the higher power that is you. Essentially, I'm trying to build a macro that runs every time a cell value is changed (in this case cell AC4). The purpose of that macro is to show / make visible one of 4 different pictures based on the value of cell AC4. The value of that cell will either be 1,2,3 or 4, and each of those numbers will show 1 picture and hide the other 3.
I think most of the code I have below is functional for my needs, but I can't seem to get the auto-run when the value of cell AC4 changes to work... that bit of code is in the first 2 lines of my code below. After the part that says "Is Nothing Then" I think I want to put my macro name, and I think I did that, but I'm getting an error. This is one of those situations where I'm not good enough with Excel to know what it is I don't know... Any assistance or suggestions concerning direction on how I could make my cobbled together code functional would be greatly appreciated. Thank you in advance for any assistance!
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Target.Worksheet.Range("$A$C4")) Is Nothing Then Worksheet_Change
If Target.Address = "$AC$4" Then
If Target.Value = 0 Then
ActiveSheet.Shapes("Group 9").Visible = True
ActiveSheet.Shapes("Group 17").Visible = True
ActiveSheet.Shapes("Group 25").Visible = True
ActiveSheet.Shapes("Group 33").Visible = True
If Target.Address = "$AC$4" Then
If Target.Value = 1 Then
ActiveSheet.Shapes("Group 9").Visible = True
ActiveSheet.Shapes("Group 17").Visible = False
ActiveSheet.Shapes("Group 25").Visible = False
ActiveSheet.Shapes("Group 33").Visible = False
If Target.Address = "$AC$4" Then
If Target.Value = 2 Then
ActiveSheet.Shapes("Group 9").Visible = False
ActiveSheet.Shapes("Group 17").Visible = True
ActiveSheet.Shapes("Group 25").Visible = False
ActiveSheet.Shapes("Group 33").Visible = False
If Target.Address = "$AC$4" Then
If Target.Value = 3 Then
ActiveSheet.Shapes("Group 9").Visible = False
ActiveSheet.Shapes("Group 17").Visible = False
ActiveSheet.Shapes("Group 25").Visible = True
ActiveSheet.Shapes("Group 33").Visible = False
If Target.Address = "$AC$4" Then
If Target.Value = 4 Then
ActiveSheet.Shapes("Group 9").Visible = False
ActiveSheet.Shapes("Group 17").Visible = False
ActiveSheet.Shapes("Group 25").Visible = False
ActiveSheet.Shapes("Group 33").Visible = True
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End Sub
I think most of the code I have below is functional for my needs, but I can't seem to get the auto-run when the value of cell AC4 changes to work... that bit of code is in the first 2 lines of my code below. After the part that says "Is Nothing Then" I think I want to put my macro name, and I think I did that, but I'm getting an error. This is one of those situations where I'm not good enough with Excel to know what it is I don't know... Any assistance or suggestions concerning direction on how I could make my cobbled together code functional would be greatly appreciated. Thank you in advance for any assistance!
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Target.Worksheet.Range("$A$C4")) Is Nothing Then Worksheet_Change
If Target.Address = "$AC$4" Then
If Target.Value = 0 Then
ActiveSheet.Shapes("Group 9").Visible = True
ActiveSheet.Shapes("Group 17").Visible = True
ActiveSheet.Shapes("Group 25").Visible = True
ActiveSheet.Shapes("Group 33").Visible = True
If Target.Address = "$AC$4" Then
If Target.Value = 1 Then
ActiveSheet.Shapes("Group 9").Visible = True
ActiveSheet.Shapes("Group 17").Visible = False
ActiveSheet.Shapes("Group 25").Visible = False
ActiveSheet.Shapes("Group 33").Visible = False
If Target.Address = "$AC$4" Then
If Target.Value = 2 Then
ActiveSheet.Shapes("Group 9").Visible = False
ActiveSheet.Shapes("Group 17").Visible = True
ActiveSheet.Shapes("Group 25").Visible = False
ActiveSheet.Shapes("Group 33").Visible = False
If Target.Address = "$AC$4" Then
If Target.Value = 3 Then
ActiveSheet.Shapes("Group 9").Visible = False
ActiveSheet.Shapes("Group 17").Visible = False
ActiveSheet.Shapes("Group 25").Visible = True
ActiveSheet.Shapes("Group 33").Visible = False
If Target.Address = "$AC$4" Then
If Target.Value = 4 Then
ActiveSheet.Shapes("Group 9").Visible = False
ActiveSheet.Shapes("Group 17").Visible = False
ActiveSheet.Shapes("Group 25").Visible = False
ActiveSheet.Shapes("Group 33").Visible = True
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End Sub