View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Find cell contents within a data matrix

Dim r as Range, r1 as Range, r2 as Range
Dim res as Variant
set r = worksheets("Data").Columns(3).Cells
set r1 = Worksheets("Sheet1").Range("A1")
res = Application.match(r,r1,0)
if not iserror(res) then
set r2 = r1(res)
msgbox "found at " & r2.Address(0,0,xlA1,True)
else
msgbox "Not found"
End if

--
Regards,
Tom Ogilvy


" wrote:

I am trying to write a macro that will find and select the first
instance of a value that the user had previously inputted into a cell
(let's say it's on sheet 1 in cell A1) within column C of a large
data matrix, where the matrix has been named DATA. How can I do
this?

Many thanks.