View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_5_] Jim Thomlinson[_5_] is offline
external usenet poster
 
Posts: 486
Default activating cell which is in rowMatch, columnMatch of two given val

Give this a try...

Sub FindIntersection()
Dim rngColumnToSearch As Range
Dim rngRowToSearch As Range
Dim rngColumnFound As Range
Dim rngRowFound As Range
Dim rngIntersection As Range
Dim wks As Worksheet

'Change the sheet row and column as necessary
Set wks = Sheets("Sheet1")
Set rngColumnToSearch = wks.Columns("A")
Set rngRowToSearch = wks.Rows(1)
'Change the next 2 lines What:="???"
Set rngColumnFound = rngColumnToSearch.Find(What:="This", LookAt:=xlWhole)
Set rngRowFound = rngRowToSearch.Find(What:="That", LookAt:=xlWhole)
If Not (rngColumnFound Is Nothing Or rngRowFound Is Nothing) Then
Set rngIntersection = Intersect(rngColumnFound.EntireRow, _
rngRowFound.EntireColumn)
MsgBox rngIntersection.Address
End If

End Sub

--
HTH...

Jim Thomlinson


"Matilda" wrote:

Dear Experts,

I cannot find any references to the following problem in any of my books,
although it seems to me it would be a common programming requirement!

I want to go to the cell in a range which is is the intersection of two
values, one in the rows, the other in the columns.

My example is a list of names in the rows, and dates in the columns. I want
to retrieve the value stored where NameX and DateY meet, but cannot find the
syntax for referencing that cell.

Any advice gratefully received.
Many thanks,

Matilda