Hi,
I am getting an overflow error. Below is the code. Please help me
with the fix. I am actually comparing data of two sheets and printing
Matched/Not Matched in the third sheet.
Sub compare()
Dim j As Integer, k As Integer
Set rngSheet_res = ThisWorkbook.Sheets("Compare").Range("A2:BL1000")
For j = 2 To 1000
For k = 1 To 100
If ThisWorkbook.Sheets("RC").Cells(j, k).Value =
ThisWorkbook.Sheets("FM").Cells(j, k).Value Then
ThisWorkbook.Sheets("Compare").Cells(j, k).Value = "Matched"
Else
ThisWorkbook.Sheets("Compare").Cells(j, k).Value = "Not
Matched"
End If
Next k
Next j
End Sub
After i run this i get an overflow run-time error. When i try to denug
this, it seems that there is an overflow in the loop for j.
Thanks
~sidd
Harald Staff - 21 Jul 2006 11:59 GMT
Hi Sidd
Your code works fine here. But don't use Integer, they are nothing but that
kind of problems. Replace Integer with Long, code will be better and
slightly faster.
HTH. Best wishes Harald
> Hi,
> I am getting an overflow error. Below is the code. Please help me
[quoted text clipped - 25 lines]
> Thanks
> ~sidd