View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Otto Moehrbach[_2_] Otto Moehrbach[_2_] is offline
external usenet poster
 
Posts: 1,071
Default Worksheet protection, going beyond inserting rows

You can do that only with VBA. Basically, you would use a Worksheet_Change
macro to pick up on the fact that a row has been added and which row it was.
Then the code can unprotect the sheet, unlock all the cells in that one row,
and protect the sheet. You would have to come up with some trigger to fire
the code to again lock the cells in that row when you want them locked. The
macro below fires when a row is inserted and unlocks the cells in that row.
Place this macro in the sheet module of your sheet. To access that module,
right-click on the sheet tab and select View Code. Paste this macro to that
module. "X" out of the module to return to your sheet. HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count = Columns.Count Then
If Target(1).Row = Target(Target.Count).Row Then
ActiveSheet.Unprotect
Target.Locked = False
ActiveSheet.Protect
End If
End If
End Sub
"Wh0079" wrote in message
...
Hello;

I performed a cursory search and could not locate this scenario.

If I want to protect a sheet but allow a user to not only insert rows
(which
needs no explanation) but allow the user to edit within the inserted rows
while still keeping the pre-existing data locked. Can I do that? If so,
how?

Thanks!