Forum Discussion
lobo114
Oct 20, 2023Brass Contributor
Carrying down a formula when inserting a row on a protected sheet
In my attached example, I am trying to carry down the formula in column E to a newly inserted row on a protected sheet. Anyone have any ideas on how to accomplish this? HansVogelaar
lobo114
Oct 24, 2023Brass Contributor
I'm looking for when any row is selected and a new row is inserted that the formula will be copied down, not just when that last row is selected.
HansVogelaar
Oct 24, 2023MVP
Try this. You could assign it to a command button and/or a Quick Access Toolbar:
Sub InsertRow()
Dim ws As Worksheet
Set ws = ActiveSheet
ws.Unprotect
Selection.EntireRow.Insert
ws.Protect AllowInsertingRows:=True, AllowInsertingHyperlinks:=True, DrawingObjects:=False
End Sub
- lobo114Oct 25, 2023Brass ContributorThat works, but is there a way to run this without assigning it to a command button or Quick Access Toolbar? I'm looking to have this macro run when you insert a row in the worksheet itself.
- HansVogelaarOct 25, 2023MVP
That'd be complicated, since there is no event that occurs specifically when a row is inserted.