Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default variable not set

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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default variable not set

Hi,

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

Mike

"RaulDR" wrote:

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!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default variable not set

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
---------------
Jacob Skaria


"RaulDR" wrote:

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!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default variable not set

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

"RaulDR" wrote:

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!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime Error '91' Object variable or With block variable not set Alec Coliver Excel Discussion (Misc queries) 2 October 24th 09 02:29 PM
Nothing Keyword Destories Objects rather than just resetting the variable to an empty variable Ronald R. Dodge, Jr.[_2_] Excel Programming 15 December 15th 08 09:19 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
Run-time error '91': "Object variable or With block variable not set Mike[_92_] Excel Programming 2 December 30th 04 10:59 AM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM


All times are GMT +1. The time now is 01:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"