OnEntry, Worksheets_change question

Hello,

Is there a way to narrow OnEntry or Worksheets_change, not to a sheet but a range in that sheet.
To avoid to much back an foward to the code?

Thank you!

Nick's picture

restrict events to particular range

Private Sub Worksheet_Change(ByVal Target As Range)
 
' look to see if the range that's being changed is within the desired range
    Set myRange = Intersect(Target, Range("A1:A10"))
 
    If myRange Is Nothing Then
' if it isn't, do nothing
        MsgBox "Outside range: do nothing"
        Exit Sub
    Else
' if it is, do what you need to do
        MsgBox "Inside range"
        Exit Sub
    End If
 
End Sub

Restric event to particular range

Thank you,

I was doing it in a less elegant way ...