Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding a Variable
Message
De
15/05/2003 03:19:44
 
 
À
Tous
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Titre:
Finding a Variable
Divers
Thread ID:
00788532
Message ID:
00788532
Vues:
41
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
Répondre
Fil
Voir

Click here to load this message in the networking platform