Protected Worksheet

  • Thread starter Thread starter David
  • Start date Start date
D

David

Is it possible to add rows to a protected worksheet
without unprotecting the worksheet first?

Tahnks for your help.
 
Only if "Contents" is unchecked on the protection dialog box. What
specifically is the issue you are having?

tim
 
Hi Dave,

You could put some code in the workbook sheet change event to set the values
of your cells back to whatever you need them to be (in the event they are
changed). Below is an example for sheet1 cells A1 =5262 and A2 =4444:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Sheet1.Range("a1").Value <> 5262 Then Range("a1").Value = 5262
If Sheet1Range("a2").Value <> 4444 Then Range("a2").Value = 4444
End Sub

tim
 
I should have mentioned it would be best to name the cells you wish to
protect, then reference the names. For example, in place of "A1" in my code
put something like "Fred" and for "A2" put "Barney". This way, if a row or
column is inserted above or to the left, the code will still work.

tim
 
Tim,
Thanks for the help.
-----Original Message-----
Hi Dave,

You could put some code in the workbook sheet change event to set the values
of your cells back to whatever you need them to be (in the event they are
changed). Below is an example for sheet1 cells A1 =5262 and A2 =4444:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Sheet1.Range("a1").Value <> 5262 Then Range ("a1").Value = 5262
If Sheet1Range("a2").Value <> 4444 Then Range("a2").Value = 4444
End Sub

tim



.
 
Back
Top