How do I keep a range with copy paste macro

Closed
mam - Aug 10, 2010 at 05:53 PM
rizvisa1 Posts 4479 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Aug 11, 2010 at 07:25 AM
Hello, I have a macro assigned to a button which copies a selection of rows in my excel worksheet & pastes it in the next blank row below. This macro is as follows:

Rows("18:61").Select
Selection.Copy
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False

In the rows covered in the main macro above, there is another macro assigned to another button which copies & inserts a row within this main selection. This macro is as follows:

Range("Agent").Select
Selection.Copy
ActiveCell.Offset(1, 0).Select
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False

When I have used the first main macro, then try to use the insert rows macro as above, the Range "Agent" only works on the second copied section as it keeps referring to the original Range that was set & therefore I cant insert rows into more than one of the main sections.

Is there a way to get the range to change when the first main macro is used e.g. give the range a new name or should i use a completely different method to get the same outcome?

Assisstance with this would be greatly appreciated.

Thanks

1 reply

rizvisa1 Posts 4479 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 768
Aug 11, 2010 at 07:25 AM
Could you please upload a sample EXCEL file WITH sample data, macro, formula , conditional formatting etc on some shared site like https://authentification.site , http://docs.google.com, http://wikisend.com/ , http://www.editgrid.com etc
A N D post back here the link to allow better understanding of how it is now and how you foresee. Based on the sample book, could you re-explain your problem too
0