Protecting an Excel List

J

John

I have created a list using the Create List function. The users input
into the list using drop down lists. Other fields are completed using
formulars. I want to protect the formulars however if I use Protect
Sheet the list cannot be updated.

I found this bit of code on this group that works fine however it will
not allow the users to delete rows and I need that functionality.

Can I add a few lines of code that will do the job?

Private Sub Worksheet_Change(ByVal Target As Range)


Dim myRng As Range
Set myRng = Me.Range("AGRegionsProtected")


On Error GoTo errHandler:


If Intersect(Target, myRng) Is Nothing Then
'let 'em do it
Else
With Application
.EnableEvents = False
.Undo
End With
MsgBox "I've asked you not to change this range!"
End If


errHandler:
Application.EnableEvents = True


End Sub


Thanks,

John
 
N

NickHK

John,
If they are deleting the value, you could check if target.Value="" and allow
it.
If the entire row then, Target.Columns.Count = Columns.Count tells if the
whole row is being deleted.

NickHK
 
J

John

Thanks Nick,

Sorry my VBA is very limited.

If I want the users to be alowed to delete whole rows even if they
contain my protected range where would I put the code?
 

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