Allow user to insert rows on protected worksheet

S

sblock

I have 3 workbooks linked together and all have different parts protected. In
one workbook, I need to allow a user to insert rows and fill down the
calculations and formulas on specific worksheets and then re-protect the
worksheet. I tried using a macro with some success, but removed the password,
was limited to the number of rows recorded in the macro and although the
macro was in one workbook, when the others were open at the same time it work
in all of them. How could I make this work in one workbook only, keep the
password and allow the user to select the number of rows.
 
P

Per Jessen

Hello
Create a macro which does what you want and call it from a button on the
desired sheet.

Sub Example()

NumOfRows = InputBox("Enter number of rows to insert . ", "Insert rows")

If NumOfRows > 0 Then
Sheets("Sheet1").Unprotect Password:="JustMe"
TargetRow = ActiveCell.Row
Rows(TargetRow & ":" & TargetRow + NumOfRows - 1).Insert
End If
' copy formulas using PasteSpecial
Sheets("Sheet1").Protect Password:="JustMe"
End Sub

Hopes it helps,

Per
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top