Test if ActiveCell is within a certain named range

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a range named "RangePriority". When I click in a cell in the
worksheet how can I test to see if it is within the range "RangePriority".

I guess it the testing would occur in:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Code Here to Test ActiveCell
End Sub

Thank you for your help.

Steven
 
if intersect(Target, Range("RangePriority") then
do something
end if

HTH
 
Hi Steven,

Try:

'=============>>
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Intersect(Range("RangePriority"), Target) Is Nothing Then
MsgBox Target.Address(0, 0) _
& " intersects with the RangePriority range"
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

Back
Top