searching excel workbooks

blitz84
03-15-2003, 09:58 AM
Is there any code that I can use in VB that will search an entire excel workbook for a certain string?

Timbo
03-16-2003, 05:28 AM
Not that I'm aware of, you'll have to search each worksheet using the 'Find' method of the Range object...

blitz84
03-16-2003, 11:08 AM
Not that I'm aware of, you'll have to search each worksheet using the 'Find' method of the Range object...


How do I use the find function?

italkid
03-16-2003, 12:37 PM
Right from Excel Vba help

With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Interior.Pattern = xlPatternGray50
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With


You'll have to count and loop thru all the worksheets.

Do a search on "find" and "count" on this forum or do a little search in the Excel Vba help.
There are lots of examples if you take the time to do at least a search your self.

italkid.

blitz84
03-18-2003, 03:54 AM
that code worked with a few minor adjustments to fit my particular needs. Thanks for your help. Just an FYI in case you were wondering why I ask questions that can be found right in the help file, I'm using the student version of VB that came with my textbook for school so it doesn't have a help file with it.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum