Reputation: 3
I have a VBA problem. I want to write a If statement where i want to say if A>=B, then 0 else B-A in a new column. and i want to repeat this till last row. Can anyone help me on this
Upvotes: 0
Views: 39
Reputation: 96753
How about:
Sub qwerty()
Dim N As Long, r As Range
N = Cells(Rows.Count, "A").End(xlUp).Row
Set r = Range("C1:C" & N)
r.Formula = "=IF(A1>=B1,0,B1-A1)"
End Sub
Upvotes: 1