Reputation: 147
Hi I have three columns (ABC) with multiple rows.
I need to check if B is greater than C, and if so to add 1 to C and repeat until the last row. I'm getting a syntax error, any help much apprecicated!
Sub test6()
Dim LastRow As Long, i As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To LastRow
If Range("B" & i).Value > ("C" & i).Value Then Range("C" & i).Value 1
Else: End If
Next i
End Sub
Upvotes: 0
Views: 48
Reputation: 3573
Delete Else: End If
as Scott Craner mentioned in comment and change If
statement:
If Range("B" & i).Value > Range("C" & i).Value Then Range("C" & i).Value = Range("C" & i).Value + 1
Upvotes: 1