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
 

Some videos you may like

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
20,046
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
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
 

yvettew78

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

Thank you for your quick response.

Will this code work with Google Sheets?
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
20,046
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
Don't know....don't use 'em.
Try it !
 

Watch MrExcel Video

Forum statistics

Threads
1,127,334
Messages
5,624,071
Members
416,010
Latest member
NJT

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