Target.Address Being One Of The Cells Of A Named Range

  • Thread starter Thread starter Faraz A. Qureshi
  • Start date Start date
F

Faraz A. Qureshi

I have applied a name to a collection dispersed cells and want to use the
same as follows but require a correct piece of code for <<???>>:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
If Target.Address <<IS A CELL OF THE RANGE NAMED "CELLS">> Then
MsgBox "YES!"
End If
ws_exit:
Application.EnableEvents = True
End Sub
 
Hi Faraz

Try

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("cells")) Is Nothing Then
MsgBox "You are within target"
End If
End Sub
 
Back
Top