Add row in a protected sheet filled with formulas from row above

muhleebbin

Active Member
Joined
Sep 30, 2017
Messages
252
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
  5. 2010
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
Could someone help with the code to add a row into a protected sheet but where it fills the row with the formula (if there is one) from the above row?

Basically i'd like to pick an unlocked cell within the sheet and have the macro insert a new row below that one and fill. If it could also highlight the current and new row, that would be awesome!

Also the code to undo this action would be helpful, I know there will be instances where this will accidentally be used.

Thanks in advance for your assistance.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I have the following code but I'd like it to paste the values from above rather than the formula's that are in place, could someone assist in fixing this?

VBA Code:
Worksheets("BofA Modified").Unprotect
   
    ActiveCell.Offset(1).EntireRow.Insert   
    ActiveCell.EntireRow.Copy ActiveCell.Offset(1).EntireRow
   
Worksheets("BofA Modified").Protect ""
 
Upvote 0
I did figure out the code to paste the values in the row below however I just realized I only want columns A-E to fill values whereas the rest of the row fills the formulas from the copied row. Could someone assist me in fixing this code to do that?

VBA Code:
Worksheets("BofA Modified").Unprotect
   
    ActiveCell.Offset(1).EntireRow.Insert   
    ActiveCell.EntireRow.Copy
    ActiveCell.Offset(1).EntireRow.PasteSpecial xlPasteValues
   
Worksheets("BofA Modified").Protect ""
 
Upvote 0

Forum statistics

Threads
1,215,006
Messages
6,122,665
Members
449,091
Latest member
peppernaut

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