Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding a Variable
Message
From
15/05/2003 03:19:44
 
 
To
All
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
Finding a Variable
Miscellaneous
Thread ID:
00788532
Message ID:
00788532
Views:
42
Hi.
I am trying to write a routine which will search for a user defined variable (PAE) 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