ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Copy and move (https://www.excelbanter.com/excel-discussion-misc-queries/225139-copy-move.html)

Larry

Copy and move
 
I am trying to copy and move 2 rows and paste. It keeps pasting 2 rows from
place i created the macro, not 2 rows from where I run the macro. I want new
paste to be 2 rows from run position

Shane Devenshire[_2_]

Copy and move
 
Hi,

Show us your code.

Generally, one replace absolute references in vba with the
ActiveCell.Offset(2,0).PasteSpecial

or something similar depending on your code.

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Larry" wrote:

I am trying to copy and move 2 rows and paste. It keeps pasting 2 rows from
place i created the macro, not 2 rows from where I run the macro. I want new
paste to be 2 rows from run position


Gary''s Student

Copy and move
 
Select a cell and run:

Sub rose()
Dim n As Long
n = ActiveCell.Row
Rows(n & ":" & n + 1).Copy Range("A" & n + 2)
End Sub

Two rows will be copied two rows down. If you put the active cell anywhere
in row 7 and run the macro, then rows 7 & 8 will be copied down to rows 9 &
10.
--
Gary''s Student - gsnu200840


"Larry" wrote:

I am trying to copy and move 2 rows and paste. It keeps pasting 2 rows from
place i created the macro, not 2 rows from where I run the macro. I want new
paste to be 2 rows from run position



All times are GMT +1. The time now is 07:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com