View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK[_3_] NickHK[_3_] is offline
external usenet poster
 
Posts: 415
Default Protecting an Excel List

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

"John"
egroups.com...
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