LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Search all sheets

I need a short macro that will search all sheets in the
active workbook for a certain string of text, and when it
finds it, it stops at that point on that sheet.

I asked a question of this newsgroup some time ago about
doing a Find & Replace operation across multiple sheets,
and got a reply, but I cannot figure out how to amend the
macro to just find and not find and replace. Could
anyone suggest how I could alter the macro below just to
do a Find on multiple sheets?

Thanks, Steve


The following macro will loop through all of the sheets
in the workbook and remove every occurrence of 1, and
replace it with 2, just for example.

Sub ReplaceAll()
On Error Resume Next
Sheets(1).Select
For i = 1 To Sheets.Count
Cells.Select
Selection.Replace What:="1", Replacement:="2",
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Range("A1").Select
ActiveSheet.Next.Select
Next i
End Sub

The On Error Resume Next line prevents the error
developed when the last sheet is encountered and
the .Next.Select line tries to execute, which it can not,
since it is at the last sheet already.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search a value in all w/sheets and make a list. TUNGANA KURMA RAJU Excel Discussion (Misc queries) 6 May 23rd 08 10:22 PM
Search in Multiple Sheets [email protected] Excel Discussion (Misc queries) 4 September 12th 07 10:33 PM
Search for datats in different Exel sheets Franz Muster Excel Discussion (Misc queries) 2 February 9th 06 05:22 PM
Time Sheets (Yes, I've already done a search on previous posts) LM813 New Users to Excel 4 January 13th 06 12:04 AM
Search Mutiple Excel Sheets. Ben Jimenez Excel Programming 0 August 8th 03 07:13 PM


All times are GMT +1. The time now is 03:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"