variable not set

R

RaulDR

Hi all,

I have this, it returns the error "variable not set"

Dim sSearch As String

sSearch = InputBox("Enter String to Search", "Search")

Application.Cells.Find(What:=sSearch, After:=ActiveCell,
LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate


thanks so much in advance!
 
M

Mike H

Hi,

There's nothing wrong with that snippet of code, your problem must lie in
another part. Post all the code.

Mike
 
J

Jacob Skaria

You search string may be missing. Try this

Sub Mac()

Dim rngTemp As Range
Dim sSearch As String

sSearch = InputBox("Enter String to Search", "Search")

On Error Resume Next
Set rngTemp = Application.Cells.Find(What:=sSearch,
After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False)

On Error GoTo 0
If Not rngTemp Is Nothing Then Application.Goto rngTemp, True

End Sub

If this post helps click Yes
 
B

Bony Pony

Is it perhaps that Option Explicit is set and you have incorrectly delcared
the variable? Or not at all?
 
R

RaulDR

Hi Jacob,

Thank you so much for your reply, my problem now is how to move the cursor
to the cell that match the "find"

Regards,
RackDr
 
R

RaulDR

I see, the variable not set error appear because Im trying to search a string
in a group of worksheet. Using ctrl-f you can search a string in a group of
worksheet how can I do that in vba?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top