Thread: Find method
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Find method

Try this

Sub Find_First()
Dim FindString As String
Dim Rng As Range
FindString = InputBox("Enter a Search value")
If Trim(FindString) < "" Then
Set Rng = Cells.Find(What:=FindString, _
After:=Range("IV" & Rows.Count), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
MsgBox Rng.Column
Else
MsgBox "Can't find the word"
End If
End If
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"benb" wrote in message ...
I want to search an entire sheet for a cell containing a value then return
the column number for that cell. I have tried variations of
n=Activesheet.Find ([value], LookIn: xlValues, LookAt: xlWhole).Column, but
any adaption I try gets a compile error. Any help?