VBA - Insert Rows and Stay in Range

pacittm

New Member
Joined
Sep 26, 2014
Messages
5
I hope you can help me - I'm at my wit's end.

I'm trying to put together a VBA Macro such that, when a user adds a row in a particular section of the sheet, which lists assets, that the macro adds a row to a couple to identical lists further down the same sheet and on a different sheet.

Basically, I want to turn:

1 Asset1
2 Asset2
3 Asset3
4 Asset4

5 Asset5


Into

1 Asset1
2 Asset2
3 Asset3
4 Asset4
5 Asset5
6 Asset6

but several times at once. It's also important that the extra rows have the same formulas in them as those around them.

To make things more complex, I have already written some code which applies to Rows 1 to 5, and I would like it to reference rows 1 to 6 when a user inserts a row - any idea how to do that? Can I make my cell references from these macros track the cells they refer to rather than the reference, when someone inserts a row? If not, how should I go about making a macro that writes a certain formula in a range if the cells the range and the cells referred to in the formula are dependent on how many rows have been added.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,214,808
Messages
6,121,684
Members
449,048
Latest member
81jamesacct

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