It seems to be working for the loop of shapes. I tried to add another variable into it, but it turns out to be issue with i variable. Any idea?


Sub test()
Dim i As Long, x As Long
'set i to the rows of B column, x as variables of shapes

For i = 5 To 35

For x = 1 To 31

If Sheet1.Cells(i, 2) = "No" Then
Sheet2.Shapes("SShape" & x).Fill.ForeColor.RGB = RGB(102, 204, 0)
Else
If Sheet1.Cells(i, 2) = "Yes" Then
Sheet2.Shapes("SShape" & x).Fill.ForeColor.RGB = RGB(255, 51, 51)
Else



End If
End If

Next i, x
End Sub

Invalid next control variable reference.