Здравствуйте.имеится макрос для защиты ячеек от изменения
Как можно сделать его компактней ???
Нужно защитить Range A1:S44
Вот сам макрос
[vba]Код
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$C$21" Or Target.Address = "$D$21"
Or Target.Address = "$E$21" Or Target.Address = "$F$21"
Or Target.Address = "$G$21" Or Target.Address = "$H$21"
Or Target.Address = "$D$21" Or Target.Address = "$E$21"
Or Target.Address = "$F$21" Or Target.Address = "$G$21"
Or Target.Address = "$G$21" Or Target.Address = "$H$21" Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End If
End Sub
[/vba]