View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Charlie Charlie is offline
external usenet poster
 
Posts: 703
Default Which Element in Range?

I presume you are searching a one-dimension range, i.e. all or part of one
row or one column, it would be something like this:

(I put "Test" into cell "D1" and am searching the entire row 1 starting at
cell "C1", ItemNo returns 2)

Dim ItemNo As Long

ItemNo = Range("C1").EntireRow.Find( _
What:="Test", LookIn:=xlValues, _
LookAt:=xlWhole).Column - _
Range("C1").Column + 1


MatchingCell

"Stratuser" wrote:

I have code that finds a cell somewhere in a range. What is the code for
determining the item number of the cell within the range (i.e., the found
cell is the nth cell within the range).