Hi All, I have the below code but I keep getting the following error message: "Complie Error, Must be first statement on the line"
I'm new to vba, can someone explain what I am doing wrong! Thank you.
I'm new to vba, can someone explain what I am doing wrong! Thank you.
Code:
Sub Chart_Background()
If Cells(4, 4).Value > 0.8 Then
ActiveSheet.ChartObjects("Chart 1").Activate
With ActiveSheet.Shapes("Chart 1").Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 0, 0)
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
.Solid
Else If Cells(4, 4) > 0.5 Then
With ActiveSheet.Shapes("Chart 1").Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 255, 0)
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
.Solid
Else
With ActiveSheet.Shapes("Chart 1").Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 255, 0)
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
.Solid
End With
End If
End Sub
[CODE]