Overflow error - what can I change?

DanielIcke

New Member
Joined
Jun 19, 2013
Messages
21
Hi guys,

I hope that you can help me out with this code:

Sub Completed8()

Dim i As Integer
Dim j As Integer

Dim BvDNumberTarget1 As Range
Dim BvDNumberTarget2 As Range
Set BvDNumberTarget1 = Range("BvDNumberTarget1")
Set BvDNumberTarget2 = Range("BvDNumberTarget2")

Application.ScreenUpdating = False

Sheets(4).Activate

For i = 1 To BvDNumberTarget1.Rows.Count
For j = 1 To BvDNumberTarget2.Rows.Count
If BvDNumberTarget1(i) = BvDNumberTarget2(j) Then
Worksheets("Orbis.Target.Online.Data.").Rows(1 + j).Copy
Worksheets("Sample6AccountingData").Rows(1 + i).Insert
Worksheets("Sample6AccountingData").Cells(1 + i, 1) = BvDNumberTarget1(i)
End If
Next
Next

Application.ScreenUpdating = True

End Sub

I have about 16000 rows in range BvDNumberTarget2 - however, I have tried and delete 13000 of those and it still provides me with the same error 6: overflow.

I hope that you can help me out here.

Best Regards,
Daniel Icke
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
I've changed that now, I hope that it will work, but the code takes ages to load, I guess due to the loop?
 
Upvote 0
It has now been running for over an hour? Can anyone help with what to improve, hence do differently to minimize the time spent running the code?
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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