![]() |
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 |
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 |
All times are GMT +1. The time now is 11:45 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com