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.
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Watch MrExcel Video

Forum statistics

Threads
1,108,816
Messages
5,525,064
Members
409,617
Latest member
Lenaf

This Week's Hot Topics

Top