Excel VBA Error 'Excel Ran out resources' - Reg

Swaminathan Gopalan

New Member
Joined
May 4, 2012
Messages
6
Hi,

I am having 2 excels each with 50000 records. I am comparing both the excels by updating formula (Sheet1 data - Sheet2 data) in the first cell & then 'Autofill' the same formula to other cells using VBA code.

Code:
[LEFT][B][U]Sample Code:[/U][/B]
ThisWorkbook.Worksheets(3).Cells(1, 1).Value = "=IF(Sheet1!H2-Sheet2!H2=0,CONCATENATE("Sheet1 Value: ",Sheet1!H2,CHAR(10),CHAR(10),"Sheet2 Value: ",Sheet2!H2),CONCATENATE("Sheet1 Value: ",Sheet1!H2,CHAR(10),CHAR(10),"Sheet2 Value: ",Sheet2!H2,CHAR(10),CHAR(10),"DIFFERENCE: ",Sheet1!H2-Sheet2!H2))"[/LEFT]
 
[LEFT]Range("A1").Select
Selection.AutoFill Destination:=Range("A1:C1"), Type:=xlFillDefault
Range("A1:C1").Select
Selection.AutoFill Destination:=Range("A1:C5"), Type:=xlFillDefault
Range("A1:C5").Select[/LEFT]

What does the formula is, it will find the difference between two sheet values and check if difference is 'zero'. If the difference is 'zero' then it will write the Sheet1 value & Sheet2 value in the corresponding cell of third sheet and if the difference is 'not zero' then it will write the Sheet1 value,Sheet2 value & their difference in a single cell​

The problem I am facing is, while comparing the formulas are getting updated correctly till 10000 rows but while updating next row I am getting error 'Excel ran out of resources while attempting to calculate one or more formulas. As a result, these formulas cannot be evaluated.' and formulas are not getting updated for other rows.
I have 50000 rows & 200 columns. I can guess that this problem might be due some memory related & not because of records/columns in sheet.Can anyone help me how to resolve this issue? Or please suggest me some better way to compare two excel files with more records like 50000 rows * 200 columns.​

Note: I am following this method of comparison as cell by cell comparison is a time consuming process​

Hope I have posted this at right place & if I am not post direct me to right place as this is my first post​

 
Yes. I have written a macro to save the HTML output in excel & get the differences.

However, i am asking this on curiosity,if anyone get some clue on how to compare two large excel files (like 50000 * 200 records),please post here so that it will be helpful in the near future.

Thank you.

Regards,
Swami
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,215,446
Messages
6,124,900
Members
449,194
Latest member
JayEggleton

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top