Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rngForbidden As Range
Set rngForbidden = Union(Range("B10:F20"), Range("H10:L20"))
'If selection does not overlap forbidden areas, do nothing
If Intersect(Target, rngForbidden) Is Nothing Then Exit Sub
Range("A1").Select
MsgBox "You can't select cells in " & rngForbidden.Address, vbCritical
End Sub
|