Saladsamurai
11-19-2009, 03:25 PM
I want my routine to do some stuff for all i = 3, 5, 10, 15 20
I tried this, but for some reason i is taking on a value of 0. Any thoughts?
Sub Test2()
Dim i As Integer
Dim j As Integer
Range("A1:A50").Delete
j = 1
For i = 3 And i = 5 To 20 Step 5
Cells(j, 1) = i
j = j + 1
Next i
End Sub
Edit: changed i values for clarity. Also i is taking on 0 because it is testing to see if i = 3 AND 5, which will never happen. Therefore it returns 0.
I have a simple workaround, but I am still curious to see how something like this could be done.
I tried this, but for some reason i is taking on a value of 0. Any thoughts?
Sub Test2()
Dim i As Integer
Dim j As Integer
Range("A1:A50").Delete
j = 1
For i = 3 And i = 5 To 20 Step 5
Cells(j, 1) = i
j = j + 1
Next i
End Sub
Edit: changed i values for clarity. Also i is taking on 0 because it is testing to see if i = 3 AND 5, which will never happen. Therefore it returns 0.
I have a simple workaround, but I am still curious to see how something like this could be done.