View Single Post
  #8   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?

Sub dural()
Dim C As Range
Set r1 = Range("Ag_Shifts_Mon")
Set r2 = Range("Ag_Shifts_Tue")
Set r = Union(r1, r2)
For Each C In Worksheets("Agency").r.Cells
If Intersect(C, Range("Ag_Shifts_Mon")) Is Nothing Then
MsgBox (C.Address & " is in Ag_Shifts_Tue")
Else
MsgBox (C.Address & " is in Ag_Shifts_Mon")
End If
Next
End Sub

I have no blank after Mon or Tue
--
Gary''s Student - gsnu200786


"MJKelly" wrote:

I'm very sorry, but I still don't understand.

Dim C As Range
For Each C In Worksheets("Agency").Range("Ag_Shifts_Mon,
Ag_Shifts_Tue").Cells

How do I determin if C is in named range Ag_Shifts_Mon or
Ag_Shifts_Tue?

Matt
PS - Many thanks for your help.