View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.programming
jindon[_32_] jindon[_32_] is offline
external usenet poster
 
Posts: 1
Default counting and loops


dic.count always from 1, not 0

but, x , dic.keys and y, dic.items from 0

therefore you need to adjust the counter

For i = 1 To dic.Count

If x(i-1) = 245 Then
counter = counter + 1
unknown = -1 * (y(i-1) - 1)
place = place + y(i-1)
Range("d" & place).Select
temp2 = "=countif(R[" & unknown & "]C[-3]:RC[-3],""azw"")"
Cells(counter, "g") = temp2
Cells(counter, "h") = y(i-1) - temp

--
jindo
-----------------------------------------------------------------------
jindon's Profile: http://www.excelforum.com/member.php...fo&userid=1313
View this thread: http://www.excelforum.com/showthread.php?threadid=38758