ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro help with copy and insert (https://www.excelbanter.com/excel-programming/380014-macro-help-copy-insert.html)

Hawkdriver

Macro help with copy and insert
 
I am trying to copy a range of rows from one workbook and insert into
another. I have two windows arranged horizontaly and am activating
workbook(2), selecting the range of rows that i want then selecting the row
in workbook(1) that i want to insert the copied rows above. The rows are not
the same range in diff. workbooks and the workbooks have different names. Is
there a way to select the "active rows" like i can with active cells?

Jason

Martin Fishlock

Macro help with copy and insert
 
Hi,

Try this

sub copyselectiontowindow2
Selection.EntireRow.Copy
Windows(2).ActiveCell.EntireRow.PasteSpecial xlPasteAll
end sub
--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Hawkdriver" wrote:

I am trying to copy a range of rows from one workbook and insert into
another. I have two windows arranged horizontaly and am activating
workbook(2), selecting the range of rows that i want then selecting the row
in workbook(1) that i want to insert the copied rows above. The rows are not
the same range in diff. workbooks and the workbooks have different names. Is
there a way to select the "active rows" like i can with active cells?

Jason


Hawkdriver

Macro help with copy and insert
 
When I have multiple worksheets open, lets say (3) and they are arranged
horizontaly so you can see all 3, how does VB move between each worksheet and
how does it relate to the sheets position? If I cannot use a name or date to
differentiate between them what is their order? and does it matter if the
macro is local to one of the sheets or can it be in the "personal"sheet?

"Martin Fishlock" wrote:

Hi,

Try this

sub copyselectiontowindow2
Selection.EntireRow.Copy
Windows(2).ActiveCell.EntireRow.PasteSpecial xlPasteAll
end sub
--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Hawkdriver" wrote:

I am trying to copy a range of rows from one workbook and insert into
another. I have two windows arranged horizontaly and am activating
workbook(2), selecting the range of rows that i want then selecting the row
in workbook(1) that i want to insert the copied rows above. The rows are not
the same range in diff. workbooks and the workbooks have different names. Is
there a way to select the "active rows" like i can with active cells?

Jason



All times are GMT +1. The time now is 11:35 PM.

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