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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,215,693
Messages
6,126,246
Members
449,304
Latest member
hagia_sofia

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