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

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
 
J

Jacob Skaria

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top