Adding an "Insert Row" button and have it get placed in a specific place

mrjack

New Member
Joined
Jan 22, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello everyone. I have created a work template that has 10 steps. Under each step is a list of things that need to be completed in each step. The problem I have is sometimes I will need to add a row under a specific step and keep the formatting from the row above. I am having a hard time figuring out how to add an "Insert row for step #" button. Once a row is added to step 1 everything below it shifts down. I want a button for each step that will insert at the bottom of said step. I am thinking about adding a row at the bottom of each step and calling it "step 1 row addition" then "hiding" that row. So the button can search for that specific text and insert a row above it. That will ensure the row gets added exactly where I want every time. I just cant figure out how to code this. Thank you!
 

Some videos you may like

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

maabadi

Well-known Member
Joined
Oct 22, 2012
Messages
1,687
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Welcome to MrExcel Message Board
If your row number is i Then
VBA Code:
Rows(i+1).Insert
OR
VBA Code:
Range("A" & i+1).EntireRow.Insert

And for Copy formatting think this:
VBA Code:
Range("A" & i+1).EntireRow.Insert, xlFormatFromLeftOrAbove
OR
VBA Code:
Range("A" & i+1).EntireRow.Insert, xlFormatFromRightOrBelow
 

Watch MrExcel Video

Forum statistics

Threads
1,128,099
Messages
5,628,682
Members
416,332
Latest member
blkbeltmjk

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
Top