VBA to add row at row 4 from column A to L only and not affecting any detail from Column M onwards. Has VBA to add new row.

nscaria00

New Member
Joined
Apr 21, 2023
Messages
21
Office Version
  1. 365
Platform
  1. Windows
I have a macro to insert new rows at A4. But whenever i add new row, obviosuly it's shifting rows from Column M onwards.
I would like to have Column M onwards stay same (not adding any new rows or affecting any graphs/ drop downs in that range.). I am attaching screen shot for your quick reference.

Currently whenever I add row, all graphs are getting messed up, affecting macro in that area (Column M onwards). I select year from Column Q and run macro for Summary.

My Insert row macro for A4 is as shown below:

Sub AddBlankRowAtA4()
' Insert a new blank row at A4 for columns A to L
Range("A4:L4").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End Sub
 

Attachments

  • Add new row at A4.JPG
    Add new row at A4.JPG
    201.3 KB · Views: 16
  • Column M onwards - Graph.JPG
    Column M onwards - Graph.JPG
    115.4 KB · Views: 9

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
You don't want to insert row, just insert cells. You can select the range, right click and choose Insert...
Then select to shift down and ok. Or use
Range("A4:L4").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
 
Upvote 0
I currently have this code, but it does move all rows from Column M as well.

Sub AddBlankRowAtA4()
' Insert a new blank row at A4 for columns A to L
Range("A4:L4").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End Sub
 
Upvote 0
I don't see how that's possible. Works for me. Are any columns between A and M hidden?
Before:
1722692852501.png


After
1722692887135.png
 
Upvote 0
Solution
Glad I could help and thanks for the recognition, although I think post 2 is the solution. Post 4 is just the picture proof of it.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

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