adding new rows in excel without breaking a vba macro that uses Range.Value

wberg82

New Member
Joined
Feb 19, 2016
Messages
38
How do I auto update a macro so that if I add rows on a sheet it updates the range the macro is pulling from? For example, in the following code, my info is pulling from row 9. If I add to rows somewhere above this, this information is on now on row 11. However, I now need the macro to pull from row 11. I don't want to have to do into VB and manually update every code as this would take me forever......

With Sheets("Hardware Load List").Range("C" & Rows.Count).End(xlUp).Offset(1)
.Offset(, 1).Resize(, 5).Value = Range("D9:H9").Value
.Offset(, 6).Value = Range("J11").Value
.Value = Range("B9").Value
End With
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Used a named range, and refer to the named range in VBA, the named range will move if you insert rows above.
To refer to a named range called test you address it:
Code:
Range("test")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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