Hi! I'm begginner in VBA, so this question might llok dumb for some of you.
I have data in A2:C17.
For D2:D17 I need following formula:
D2=IF(B2>=15;A2+B2;B2).
My VBA code is this:
Sub Rectangle1_Click()
Dim x As Integer
For x = 2 To 17
If Cells(x, 2).Value >= 15
Then
Cells(x, 4).Value = Cells(x, 2) + Cells(x, 1)
Else
Cells(x, 4).Value = Cells(x, 2)
End If
Next x
End Sub
It shows Compile Error: Syntax Error and colors this line red:
If Cells(x, 2).Value >= 15
Then
What I am doing wrong?
Bookmarks