Hi all,
I'm trying to use the following piece of code and keep getting a Syntax error for the Else If command.
Sub Macro1()
Dim iRow As Integer
For iRow = 16 To 50
If Cells(iRow - 1, 7) - Cells(iRow, 7) = Cells(iRow - 1, 7) Then
Cells(iRow, 7) = "0"
Else If
Cells(iRow - 1, 7) - Cells(iRow, 7) = "0" Then
Cells(iRow, 7) = "0"
Else
Cells(iRow, 7).Value = Cells(iRow - 1, 7) + Range("Q14")
End If
Next iRow
This is a valid command as far as I can tell. Any ideas why this might be happening?
Thanks
John
I'm trying to use the following piece of code and keep getting a Syntax error for the Else If command.
Sub Macro1()
Dim iRow As Integer
For iRow = 16 To 50
If Cells(iRow - 1, 7) - Cells(iRow, 7) = Cells(iRow - 1, 7) Then
Cells(iRow, 7) = "0"
Else If
Cells(iRow - 1, 7) - Cells(iRow, 7) = "0" Then
Cells(iRow, 7) = "0"
Else
Cells(iRow, 7).Value = Cells(iRow - 1, 7) + Range("Q14")
End If
Next iRow
This is a valid command as far as I can tell. Any ideas why this might be happening?
Thanks
John