Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to Search and Replace


I'm wondering if its possible to have a macro that will find cells wit
specified text and replace it with other specified text.

I have a lot of files that have these same cells that need to b
modified and looking for a way to save time.

Thanks

--
Excel_Rooki
-----------------------------------------------------------------------
Excel_Rookie's Profile: http://www.excelforum.com/member.php...fo&userid=1467
View this thread: http://www.excelforum.com/showthread.php?threadid=26287

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Macro to Search and Replace

Hey Rookie,

If the files are all in the same folder, and are only one sheet long, then
something like this will do it:

Sub RunMacroOnAllFilesInFolder()
With Application.FileSearch
.NewSearch
'Change the folder name
.LookIn = "C:\Excel"
.FileType = msoFileTypeExcelWorkbooks
If .Execute 0 Then
For i = 1 To .FoundFiles.Count
Workbooks.Open .FoundFiles(i)
'Put your recurring macro code here
Cells.Replace What:="FindThis", _
Replacement:="Replacement", _
LookAt:=xlPart
ActiveWorkbook.Close True
Next i
End If
End With
End Sub

HTH,
Bernie
MS Excel MVP

"Excel_Rookie" wrote in message
...

I'm wondering if its possible to have a macro that will find cells with
specified text and replace it with other specified text.

I have a lot of files that have these same cells that need to be
modified and looking for a way to save time.

Thanks.


--
Excel_Rookie
------------------------------------------------------------------------
Excel_Rookie's Profile:

http://www.excelforum.com/member.php...o&userid=14670
View this thread: http://www.excelforum.com/showthread...hreadid=262879



Reply
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
Macro Search and Replace [email protected] Excel Discussion (Misc queries) 2 September 23rd 08 01:13 PM
macro to search and replace with offset Tim Excel Discussion (Misc queries) 5 December 11th 04 09:30 PM
SEARCH & REPLACE MACRO Josh[_11_] Excel Programming 2 August 4th 04 05:07 PM
Macro to search a column for a specific word and replace with wendy Excel Programming 5 January 19th 04 05:41 PM
Macro search replace question WDP[_2_] Excel Programming 1 August 28th 03 06:18 AM


All times are GMT +1. The time now is 03:15 PM.

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

About Us

"It's about Microsoft Excel"