I am using the following VBA Else-If code:
If ActiveSheet.Range(range_name).Value < "8.50%" Then
ActiveSheet.Shapes.Range(Array(shape_name)).Select
With Selection.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(192, 0, 0)
.Transparency = 0
.Solid
End With
ElseIf ActiveSheet.Range(range_name).Value < "9.70%" Then
ActiveSheet.Shapes.Range(Array(shape_name)).Select
With Selection.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 255, 0)
.Transparency = 0
.Solid
Else
ActiveSheet.Shapes.Range(Array(shape_name)).Select
With Selection.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 255, 0)
.Transparency = 0
.Solid
End With
When I run this, I receive an error: "Else without If ". So, I changed the Else line to:
ElseIf ActiveSheet.Range(range_name).Value >= "9.70%" Then
But still, it is giving me the same error, even though this Else has an If
Why is that? And the first code is also correct and shouldn't give an error in the first place. So why is this happening? Thanks in advance!