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

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.
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,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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