View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jean-Paul Viel[_2_] Jean-Paul Viel[_2_] is offline
external usenet poster
 
Posts: 8
Default Max value in Do While counter

Hi,



The maximum value for an integer is 32,767. If you wand more declare your
variables as long witch is about 2 billions, you should have enough.




--
JP

http://www.solutionsvba.com


"ChrisG" wrote in message
...
I get this code to work for small lists, however, the
real test is on almost 54,000 records and the code
crashes when j = 32,767. In a nutshell Col B and Col C
have values and are being compared against Col F and Col
G (If B=F AND C=G, then H=1)

Dim i As Integer
Dim j As Integer

i = 1
j = 1

Do While Not (IsEmpty(Cells(i, 2)))
i = i + 1
Do While Not (IsEmpty(Cells(j, 6)))
j = j + 1
If ((Cells(i, 2) = Cells(j, 6)) And (Cells(i, 3)
= Cells(j, 7))) Then Cells(j, 8) = "1"
Loop
j = 1
Loop