Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / July 2006

Tip: Looking for answers? Try searching our database.

Please help me with run-time error '6' Overflow.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sidd.das@gmail.com - 21 Jul 2006 09:47 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.