Software: Excel365
Hi im using the following code to try and get a shape to change colour based on the text in Cell "C8"
The code is contained in the worksheet tab
however, when testing it out by typing in either Red, green or yellow i get an error message - "wrong number of assignments or invalid property assignment"
Private Sub WORKSHEET_CHANGE(ByVal TARGET As Range)
If Range("C8") = "RED" Then
ActiveSheet.Shapes.Range.Fill(Array("RUGELEY")).Select
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 0, 0)
Else
If Range("C8") = "GREEN" Then
ActiveSheet.Shapes.Range.Fill(Array("RUGELEY")).Select
Selection.ShapeRange.Fill.ForeColor.ObjectThemeColor = msoThemeColorAccent6
Else
If Range("C8") = "YELLOW" Then
ActiveSheet.Shapes.Range.Fill(Array("RUGELEY")).Select
Selection.ShapeRange.Fill.ForeColor.ObjectThemeColor = msoThemeColorAccent4
End If
End If
End If
ActiveSheet.Cells(8, 3).Select
End Sub
Thanks
Hi im using the following code to try and get a shape to change colour based on the text in Cell "C8"
The code is contained in the worksheet tab
however, when testing it out by typing in either Red, green or yellow i get an error message - "wrong number of assignments or invalid property assignment"
Private Sub WORKSHEET_CHANGE(ByVal TARGET As Range)
If Range("C8") = "RED" Then
ActiveSheet.Shapes.Range.Fill(Array("RUGELEY")).Select
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 0, 0)
Else
If Range("C8") = "GREEN" Then
ActiveSheet.Shapes.Range.Fill(Array("RUGELEY")).Select
Selection.ShapeRange.Fill.ForeColor.ObjectThemeColor = msoThemeColorAccent6
Else
If Range("C8") = "YELLOW" Then
ActiveSheet.Shapes.Range.Fill(Array("RUGELEY")).Select
Selection.ShapeRange.Fill.ForeColor.ObjectThemeColor = msoThemeColorAccent4
End If
End If
End If
ActiveSheet.Cells(8, 3).Select
End Sub
Thanks