Protected Worksheet

D

David

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

Tahnks for your help.
 
T

Tim Otero

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

tim
 
T

Tim Otero

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
 
T

Tim Otero

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
 
D

David

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



.
 

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