VBA code help

  • Thread starter Thread starter jlclyde
  • Start date Start date
J

jlclyde

Everytime I run this code it bugs out. Can anyone tell me why? I
just want to find my monkey is that so hard. I am trying to find the
word monkey on a spreadsheet and then i will be bale to create other
code to offset from this anchor. The trick is finding the monkey.

Thanks,
Jay

Sub Macro5()
Dim rFound As Range
Dim form As Worksheet

Set rFound = Sheets("RA and inspect
form").Columns(1).Find(What:="Monkey", _
After:=Sheets("RA and inspect form").Cells(1, 1),
LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False)
Set form = Sheets("RA and Inspect form")
form.Range(rFound).Select

End Sub
 
Try this

Sub Macro5()
Dim rFound As Range
Dim form As Worksheet

With Sheets("RA and inspect form")
Set rFound = .Columns(1).Find( _
What:="Monkey", _
After:=.Cells(1, 1), _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
If Not rFound Is Nothing Then
.Activate
rFound.Select
End If
End With
End Sub

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Back
Top