View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default A cell is in which named range?

Be aware that a single can be in many Named Ranges at the same time if the
ranges over-lap.

if not:

Sub whereAmI()
Set r = ActiveCell
For Each n In ThisWorkbook.Names
If Intersect(r, Range(n)) Is Nothing Then
Else
MsgBox ("the active cell is in range " & n.Name)
End If
Next
End Sub

--
Gary''s Student - gsnu2007h


"MJKelly" wrote:


Hi,

I am looping through multiple named ranges. Depending which named
range a value is in, I need to reference another named range
(basically Monday, Tuesday etc). How Can I Select Case to find the
named range of the current cell to determin which other named range to
move to? So a cell in MondayData named range will be reported in
MondayReport named range. I see this as an option for me to re-use
the code instead of using seven versions of the code (one for each
day).

Hope you can help?

kind regards,
Matt