Macro Help

Amy Beryl

Board Regular
Joined
May 5, 2011
Messages
54
Hi All -

I am trying to write a macro (see below) that copies a 2 row range to another place. The "copy to" place is where the cursor is when I activate the macro. I want the macro to paste the row range to wherever I am when I run it. It's not working (if it was working I wouldn't be here). It seems that the cursor moves during the execution of the macro instead on staying where I am when I start the macro.

Any help would be appreciated.

Amy

Sub Macro2()
'
Rows("21:22").Select
Selection.Copy
ActiveCell.Select
Selection.Insert Shift:=xlDown
End Sub
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Maybe

Code:
Sub Macro2()
'
Rows("21:22").Copy
ActiveCell.Resize(2).EntireRow.Insert Shift:=xlDown
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,502
Messages
6,179,126
Members
452,890
Latest member
Nikhil Ramesh

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