Excel Crashes after copy/paste macro

Engineer Joe

Well-known Member
Joined
Jun 10, 2005
Messages
549
Code:
Sub CopyInsertRow()
On Error Resume Next
    Selection.EntireRow.Copy
    Selection.EntireRow.Insert
End Sub

I've run the above script a ton. I've got it shortcut key'd. Sometimes I run it 5 or 6 in a row. Almost daily, directly after running it, Excel will crash and I'll get that "Excel has stopped working" message. I noticed it's basically only after this macro that Excel will crash, but it's only like 1 out of every 100 times. Anyone know what could be causing that or how to fix it?
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
How many cells are you selecting?
Also are you ever selecting non contiguous cells
 
Upvote 0
I may select as many as 8 to 10 cells usually, which in the VBA converts to 8 ot 10 rows. Almost never non-contiguous.
 
Upvote 0
In that case there's no obvious reason that I can think of.
When it crashes do you get an "Out of memory" warning, or anything similar?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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