View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Steve[_75_] Steve[_75_] is offline
external usenet poster
 
Posts: 3
Default integer value won't change

I have a procedure which contains the following:
------------------------------------------------------------------------------------------------------------------------------
Dim i as integer
Dim r as integer

CheckCSXU:
i = 3
r = 1

For Each ccell In Sheets("COMPARED").Range(Cells(1, 1), _
Cells(65535, 1).End(xlUp)) 'cycle through COMPARED sheet
comparedvalue = ccell.Value

Do
With Sheets(sheettitle)
csxuvalue = .Cells(i, r).Value
End With

If i 22 And r < 14 Then
i = 3 And r = r + 3 ***PROBLEM HERE***
End If

If i 22 And r = 14 Then
i = 26 And r = 2
End If

If i 54 And r < 14 Then
i= 26 And r = r + 3
End If

If i 45 And r = 14 Then
GoTo Continue 'calls next sheet in workbook
End If

If comparedvalue = csxuvalue Then 'found a match, so add the date
next to compared cell
Sheets("COMPARED").Select
ccell.Offset(0, 2).Value = Sheets(sheettitle).Cells(i, r +
1).Value
i = i + 1
Else
i = i + 1
End If
Loop Until i = 45 And r = 13
Next ccell 'next cell in "COMPARED" sheet
------------------------------------------------------------------------------------------------------------------------------
Problem is that when the first condition is met (i 22 And e < 14) I would
like i to now equal 3, and r to equal 4, but this doesn't happen. i changes
from 1 to 0 and r stays at 1. Could someone help a novice out?

Thanks for your time...