View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default For Next (non consecutive values for i)

Sub caroline()
s = Array(1, 4, 5, 6, 8, 10)
For i = LBound(s) To UBound(s)
MsgBox (s(i))
Next
End Sub

--
Gary''s Student - gsnu200724


"caroline" wrote:

When using the For i = 1 to 10
€˜Your code
Next i

Can I define i = 1 to 10 (excluding certain values)?
I want the code to be executed only for i= 1,4,5,6,8,10

Thanks
--
caroline