View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
GTVT06 GTVT06 is offline
external usenet poster
 
Posts: 141
Default function to find value and return cell reference

On Jan 17, 6:52*pm, rcc wrote:
Hi,

I'm looking for a function that will find a value somewhere on a spreadsheet
and return its cell reference. *For instance, I'd like to be able to have a
function that will take '300' and the data range 'A1:D5' and then return the
cell that '300' is found in, i.e. D3 (if indeed D3 contains '300').

Do I need to write a macro for this?

Thanks,
rcc


you can create a macro similar to something along the lines of this:

Sub try()
Dim cell As Range
Dim i As String
i = InputBox("Search for:")
For Each cell In Range("A1:D5")
If cell.Value = i Then
MsgBox (i & " Is in cell " & cell.Address)
End If
Next cell
End Sub