Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

excel 97 find method

Status
Not open for further replies.

wsuh

Programmer
Jun 28, 2001
6
US
I'm trying to create a simple search tool in Excel 97. Let me preface my problem by saying the following code works perfectly in Excel 2000. But in Excel 97, I receive the following error: run time error '1004' unable to get the find property of the range class. Here's the code, please help! I've already checked the microsoft site.

Dim rg1 As Range
Dim stringToFind As String
'-- this sub finds a control number

stringToFind = _
Application.InputBox("Enter Search", "Find")


' Set an object variable to evaluate the Find command.
Set rg1 = ActiveSheet.Columns(1).Find(What:=stringToFind)

' If the string is not found, show this message box.
If rg1 Is Nothing Then
MsgBox "Search Value Not Found.", vbExclamation
Else
rg1.Activate

End If
 
There is a thread in the MS office forum that has a lengthy discussion about the find feature. Try that, and if it doesn't help, post again.

Auto Find (CTRL-F) in batch, and store results, macro.
Started by Nat101

 
This thing finds the first occurance of the variable in column A and will go somewhere to do something if nothing found....if a match is made it will scroll to thus activating the cell.
Just change my variable to your inputbox variable.


Sheets("Sheet1").Activate
strWhat = fromdate
[A1].Activate
If IsEmpty(ActiveCell.Offset(1, 0).Value) Then
GoTo endsheet1section
Else
lastrow = [A1].End(xlDown).Row
End If

rr = Range("A1:A" & lastrow)
For Each I In rr
Set R = Cells.Find(What:=strWhat, After:=Range("A1"), LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
If R Is Nothing Then
GoTo nosheet1fromdatefound
End If
If Not R Is Nothing Then
Application.Goto R, Scroll:=True
startcopyrow = ActiveCell.Row
GoTo findsheet1todate
Exit For
End If
Next I
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top