Adding Rows using Command Button

batonrougejosh

New Member
Joined
Feb 23, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello,
After looking through a lot of post, I cannot seem to find exactly what I need.

I am looking to add a command button in 'Cell B17' that will insert a new row after 'Row 15' and copy all formatting (some columns have list, some nothing, some formulas) from 'Row 15' into newly inserted row.

Couple things:
After I insert a new row, I need the command button to move down with everything and now reside within the parameters of 'cell B18'. (Keep going on as many rows as needed)
After using the command button once, I need it to do the same thing, just now adding new row after 'row 16' and copying formulas from 'row 16'. (Keep going on as many rows as needed)
Lastly, I cant have any button prompt asking how many rows or where to add rows. Just need it to do add as I click.

I hope someone can help me with this. It would be amazing if I could get this to work!!

THANKS ALOT

J
 

Attachments

  • Screenshot 2023-02-23 142442.png
    Screenshot 2023-02-23 142442.png
    11.9 KB · Views: 36

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I did something similar in one of my workbooks; however, I put the buttons at the top of the sheet and the user would select any cell in the row where they want to insert before clicking the button. After inserting the row, it will copy formulas in columns E,K-ZZ to the new row and one beyond. Here's the code I used.:

VBA Code:
Private Sub InsertRowFormulas_Click()
   With Selection
     If .Areas.Count = 1 Then
        .EntireRow.Insert
        Intersect(.EntireRow.Offset(-.Rows.Count - 1).Resize(.Rows.Count + 2), Range("E:E,K:ZZ")).FillDown
     End If
   End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,749
Messages
6,174,275
Members
452,553
Latest member
red83

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