Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Seaching for a variable within worksheets
Message
From
14/05/2003 04:42:16
 
 
To
All
General information
Forum:
Visual Basic
Category:
VBA
Title:
Seaching for a variable within worksheets
Miscellaneous
Thread ID:
00788077
Message ID:
00788077
Views:
119
Hi.
I am trying to write a routine which will search for a user defined variable within an excel spreadsheet. I can set a variable to 'er' for example and the following code works (starting on sheet 1 and working through to sheet 'x'). But if I change the variable to 'stock' for example then the routine works over several sheets then breaks with 'Runtime error 91 - Object variable or with block variable not set'

Can anyone help please? (thanks)

Here is an extract of the code ---

For i = 1 To Sheets.Count
Title = "Currently Searching on TAB - " & Sheets(i).Name
Worksheets(i).Activate
Range("A1").Activate
Response = vbYes
While Response = vbYes 'Look for Variable
Cells.Find(What:=PAE, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) _
.Activate
Response = MsgBox(Msg, Style, Title, Help, Ctxt) 'Display message
Wend
Next i
Reply
Map
View

Click here to load this message in the networking platform