Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

Search all worksheets

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jneaves@clemson.edu - 12 Sep 2007 21:30 GMT
Hey, I have a workbook with many worksheets. I am trying to write a
macro to search all the worksheets for a unique value. I have a
userform to enter the value and assign it to a variable. I just need
to search all sheet for that string, and if that string exists in a
worksheet, activate that worksheet. Anyone done anything like this?
Can you help?
Jim Thomlinson - 12 Sep 2007 22:02 GMT
This should be close...

Sub FindStuff()
   Dim wks As Worksheet
   Dim rngFound As Range
   
   For Each wks In Worksheets
       Set rngFound = wks.Cells.Find(What:="asdf", _
                                     LookAt:=xlPart, _
                                     LookIn:=xlFormulas, _
                                     MatchCase:=False)
       If Not rngFound Is Nothing Then
           wks.Select
           rngFound.Select
           Exit For
       End If
   Next wks
End Sub
Signature

HTH...

Jim Thomlinson

> Hey, I have a workbook with many worksheets. I am trying to write a
> macro to search all the worksheets for a unique value. I have a
> userform to enter the value and assign it to a variable. I just need
> to search all sheet for that string, and if that string exists in a
> worksheet, activate that worksheet. Anyone done anything like this?
> Can you help?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.