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 Display the Cell Number of Cell if Value =Value

Enter:

Sub collectum()
Dim r As Range
Dim i, j As Long
Set r = Selection
v = r.Value
j = 1
For i = 3 To 25000
If v = Cells(i, "x").Value Then
r.Offset(0, j).Value = i
j = j + 1
End If
Next
End Sub

Put you target value in Z10 ( or any other cell to the right of column X),
Select that cell and run the macro. AA10, AB10, AC10,...will be filled with
matching row numbers.

--
Gary's Student


"Pete" wrote:

I need to figure out a way to look at a range of cell values (all numbers)
and return the cell number of where it falls within the list.

Reference list in Column X (X3:x25000)
# to look for in Cell Z10

Bsically if Z10 id found in X45, X76 and X5000; return 45,76,5000 in
adjacent cells.

I would like the cell #'s found to be listed next to the look for # either
in line or row format.

Does anyone have a code for this?

TIA
--
Pete