I'm not sure why I am getting this error message. I thought I had the correct indents, and I also made sure to have a new line after "then" in the if statements. Any suggestions? Here is my code
Code:
Sub AddMilestone()
Set s1 = ThisWorkbook.Worksheets("Release Input")
Set s2 = ThisWorkbook.Worksheets("Release Calendar")
Dim rdate As Range
Dim rlast As Long
rlast = s2.Cells(Rows.Count, "A").End(xlUp).Row
Set rdate = s2.Range("e5:sz5" & rlast)
'Set rdate = s2.Range("e5:rz29")
Set mdate = s1.Range("f2:h4")
Dim rcell As Range
Dim mcell As Range
For Each rcell In rdate.Cells
For Each mcell In mdate.Cells
If s1.Cells(mcell.Row, 3).Value = s2.Cells(rcell.Row, 1).Value Then
If s1.Cells(mcell.Row, mcell.Column).Value = s2.Cells(4, rcell.Column).Value And rcell.Interior.color <> vbWhite And rcell.Interior.ThemeColor <> xlThemeColorDark1 Then
With rcell
If s1.Cells(mcell.Row, mcell.Column).Interior.color = vbYellow Then
Set shp = s2.Shapes.AddShape(msoShape5pointStar, .Left, .Top, .Width, .Height)
shp.Height = 15
shp.Width = 15
With shp.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 255, 0)
.Transparency = 0
.Solid
ElseIf s1.Cells(mcell.Row, mcell.Column).Interior.color = vbBlue Then
Set shp = s2.Shapes.AddShape(msoShape5pointStar, .Left, .Top, .Width, .Height)
shp.Height = 15
shp.Width = 15
With shp.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 0, 0)
.Transparency = 0
.Solid
End With
End With
' ElseIf s1.Cells(rcell.Row, 6) = "" Then Exit For
End If
End If
Next mcell
Next rcell
End Sub
Last edited by a moderator: