montecarlo2012
Well-known Member
- Joined
- Jan 26, 2011
- Messages
- 985
- Office Version
- 2010
- Platform
- Windows
Hello.
I am working out this idea
From here I tried to loop, in order to make it shorter. like this:
but give me an error
debug show me this line
Cells(x, 2).Formula = "= IF(" & Cells(y, 2) & ">=" & Cells(z, 2) & ",true, false)"
What I did wrong.
Please let me know.
Thanks for reading.
I am working out this idea
VBA Code:
sub test0()
Cells(15, 2).Formula = "=IF(" & Cells(2, 2) & ">=" & Cells(7, 2) & ",TRUE, FALSE)"
Cells(31, 2).Formula = "=IF(" & Cells(18, 2) & ">=" & Cells(23, 2) & ",TRUE, FALSE)"
Cells(47, 2).Formula = "=IF(" & Cells(34, 2) & ">" & Cells(39, 2) & ",TRUE, FALSE)"
Cells(63, 2).Formula = "=IF(" & Cells(50, 2) & ">=" & Cells(55, 2) & ",TRUE, FALSE)"
Cells(79, 2).Formula = "=IF(" & Cells(66, 2) & ">=" & Cells(71, 2) & ",TRUE, FALSE)"
Cells(95, 2).Formula = "=IF(" & Cells(82, 2) & ">=" & Cells(87, 2) & ",TRUE, FALSE)"
end sub
From here I tried to loop, in order to make it shorter. like this:
VBA Code:
Sub test1()
Dim y%
Dim z%
Dim x%
y = 2
z = 7
For x = 15 To 95 Step 16
Cells(x, 2).Formula = "= IF(" & Cells(y, 2) & ">=" & Cells(z, 2) & ",true, false)"
y = y + 16
z = z + 16
Next x
End Sub
but give me an error
debug show me this line
Cells(x, 2).Formula = "= IF(" & Cells(y, 2) & ">=" & Cells(z, 2) & ",true, false)"
What I did wrong.
Please let me know.
Thanks for reading.