Error while running macro on Huge rows

motherindia

Board Regular
Joined
Oct 15, 2015
Messages
218
Hello Sir,

The macro will work upto 1.25 lak rows with 110 column, but throws error if it exceeds 1.25 lakh rows with following message


Run time error 7
over flow error.
How could it be fixed



Special thanks to Jindon Sir for providing short code to perform lookup function.
However when I try it on small data it will work. But if number of rows exceed 50k it will error at following line;

a = Sheets("sheet1").Range("a1").CurrentRegion.Resize(, 300).Value


following is the macro used by me.


Sub test()
Dim a, i As Long
a = Sheets("sheet2").Range("a1").CurrentRegion.Resize(, 200).Value
With CreateObject("Scripting.Dictionary")
For i = 2 To UBound(a, 1)
.Item(a(i, 1)) = a(i, 2)
Next
a = Sheets("sheet1").Range("a1").CurrentRegion.Resize(, 300).Value
a(1, 3) = "Supplier Name"
For i = 2 To UBound(a, 1)
If .exists(a(i, 2)) Then a(i, 250) = .Item(a(i, 2))
Next
End With
Sheets("sheet1").Range("a1").CurrentRegion.Resize(, 250).Value = a
End Sub


Regards,
motherindia
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

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