#1   Report Post  
Member
 
Posts: 36
Default Cell Protection

I have been using the below mentioned VBA code for cell protection,
It is protected only one Cell ("A2") We need to protect from A2 to A8, Pls help me.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Target.Address < "$A$2" Then Exit Sub

Application.EnableEvents = False

MsgBox "Hey, leave me alone!"

Application.Undo

Application.EnableEvents = True

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,514
Default Cell Protection

Try...

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Intersect(Target, Range("$A$2:$A$8")) Then
With Application
.EnableEvents = False: .Undo: .EnableEvents = True
End With 'Application
MsgBox "Hey, leave me alone!"
End If
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Data Protection Best Practice: AKA: Real Sheet Protection Mushman(Woof!)[_2_] Excel Discussion (Misc queries) 4 December 30th 09 01:20 AM
Excel Data Protection- AKA: Sheet/Macro Password Protection Mushman(Woof!) Setting up and Configuration of Excel 0 December 29th 09 06:50 AM
Password Protection - paste to unprotected cell locks the cell Jimbob Excel Discussion (Misc queries) 7 September 7th 07 06:22 PM
Cell Protection vs. Worksheet Protection kmwhitt Excel Discussion (Misc queries) 4 September 24th 06 02:37 AM
Need help with cell protection... Mark F.[_2_] Excel Programming 7 January 26th 04 06:14 PM


All times are GMT +1. The time now is 02:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"