Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Seaching for a variable within worksheets
Message
De
14/05/2003 04:42:16
 
 
À
Tous
Information générale
Forum:
Visual Basic
Catégorie:
VBA
Titre:
Seaching for a variable within worksheets
Divers
Thread ID:
00788077
Message ID:
00788077
Vues:
117
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
Répondre
Fil
Voir

Click here to load this message in the networking platform