VBA - Insert row and copy formulas up to new row

cvrband

Board Regular
Joined
Jan 6, 2016
Messages
61
Office Version
  1. 365
Platform
  1. Windows
I am trying to insert a row, say between rows 5 and 6 in my example data below and then copy the formulas up from row 7 (previously row 6) into the new row 6. I tried to figure out the code on my own by recording a macro but determined that my formulas are not correct for the desired result with my method of inserting and copying rows. As you will see below in my "Original Data" section, some cells reference the cell above (ie. cell 'C6' is '=C5'), so when I insert a row between rows 5 & 6, the new row 7 (old row 6) still references row 5. I need the new row 7 to reference the new row 6 and the new row 6 to reference row 5. The rows that are 2 rows below the newly inserted row update and are correct after the insertion. (I hope that makes sense)

I would greatly appreciate help writing VBA to achieve my desired result. Thank you in advance.

Book1
ABCDEFGHIJKLMN
1
2Original DataWhat happens when I insert a new row in row 6 and copy row 7 up to row 6Desired result
3
4Item No.LengthWidthRef.Item No.LengthWidthRef.Item No.LengthWidthRef.
511020Blue11020Blue11020Blue
621020Blue#VALUE!LengthWidthRef.21020Blue
731020Red21020Blue31020Blue
841220Blue31020Red41020Red
951220Green41220Blue51220Blue
106124Green51220Green61220Green
116124Green7124Green
Sheet1
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Why not trying to have your macro actually adding the formula needed in the new cells?
 
Upvote 0
Thanks for replying jxb. What I provided is an extremely simplified version of the spreadsheet and if I were to use that method the VBA would be quite extensive with formulas. The code created will need to be implemented across several worksheets in the workbook. I feel that I can manipulate it across sheets if I can get help with the insert/copy part. Thanks
 
Upvote 0
I'm putting my original post back out to the forum since no resolution to date. Thanks in advance.
 
Upvote 0

Forum statistics

Threads
1,214,913
Messages
6,122,207
Members
449,074
Latest member
cancansova

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