ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Allow user to insert rows on protected worksheet (https://www.excelbanter.com/excel-discussion-misc-queries/210375-allow-user-insert-rows-protected-worksheet.html)

sblock

Allow user to insert rows on protected worksheet
 
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.

Per Jessen

Allow user to insert rows on protected worksheet
 
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

"sblock" skrev i meddelelsen
...
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.




All times are GMT +1. The time now is 07:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com