View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default For Next (non consecutive values for i)

One way:

Dim vArr As Variant
Dim i As Long
Dim j As Long
vArr = Array(1,4,5,6,8,10)
For j = LBound(vArr) to UBound(varr)
i = vArr(j)
'Your code
Next j



In article ,
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