marreco
10-11-2012, 05:50 PM
Hi.
I need help, in two parts of my code.
When the cell 'A2' equals 'ret' form does not change color
When the cells 'A2' is equal to or different from empty ("Los Tri, Los") all forms must be white.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A2")) Is Nothing Then
If Target.Value = "Ret" Then 'that part is not working
ActiveSheet.Shapes("Ret").Select 'that part is not working
ActiveSheet.Shapes("Ret").Fill.BackColor.RGB = vbYellow 'that part is not working
ElseIf Target.Value = "Tri" Then
ActiveSheet.Shapes("Tri").Select
ActiveSheet.Shapes("Tri").Fill.ForeColor.RGB = vbRed
ElseIf Target.Value = "Los" Then
ActiveSheet.Shapes("Los").Select
ActiveSheet.Shapes("Los").Fill.ForeColor.RGB = vbGreen
Else
ActiveSheet.Shapes("Los, Tri, Los").Fill.ForeColor.RGB = vbWhite 'that part is not working
End If
End If
End Sub
I need help, in two parts of my code.
When the cell 'A2' equals 'ret' form does not change color
When the cells 'A2' is equal to or different from empty ("Los Tri, Los") all forms must be white.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A2")) Is Nothing Then
If Target.Value = "Ret" Then 'that part is not working
ActiveSheet.Shapes("Ret").Select 'that part is not working
ActiveSheet.Shapes("Ret").Fill.BackColor.RGB = vbYellow 'that part is not working
ElseIf Target.Value = "Tri" Then
ActiveSheet.Shapes("Tri").Select
ActiveSheet.Shapes("Tri").Fill.ForeColor.RGB = vbRed
ElseIf Target.Value = "Los" Then
ActiveSheet.Shapes("Los").Select
ActiveSheet.Shapes("Los").Fill.ForeColor.RGB = vbGreen
Else
ActiveSheet.Shapes("Los, Tri, Los").Fill.ForeColor.RGB = vbWhite 'that part is not working
End If
End If
End Sub