Help with a Script to Add New Line & Copy formulas

yvettew78

New Member
Joined
Aug 23, 2020
Messages
34
Platform
  1. Windows
  2. Web
Hi Everyone

I am trying to work out a script so that when I click on the PLUS Button I have created, it inserts a new row and inserts the formulas that relate to it. Please see a screenshot of the sheet (I want it to add a new row after B18 and copy the formulas that are in Cells B18, D18 & E18).

Capture.PNG


Thank you
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Try
VBA Code:
Sub MM1()
Cells(Rows.Count, "B").End(xlUp).Offset(-1, 0).EntireRow.Copy
Rows(Selection.Row - 1).Insert
Application.CutCopyMode = False
End Sub
 
Upvote 0
Hi Michael

Thank you for your quick response.

Will this code work with Google Sheets?
 
Upvote 0
Don't know....don't use 'em.
Try it !
 
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,385
Members
448,956
Latest member
JPav

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