Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Find and Replace within workbook - from Visual basic

I need to find a string on a worksheet and change the formatting so it stands
out. That's easy. Actually, I want to find a bunch of strings on all
worksheets in a workbook. I recorded a macro that does the find and replace.
I selected the "options" button on the find and replace dialog box and
changed the "within" to "Workbook". Did the replace and it worked great.

However, the macro does NOT contain the code to change the option from
Worksheet to workbook! :-(

I imagine it's a one liner. Any idea what that is?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find and Replace within workbook - from Visual basic


While you were recoding the macro after you click on replace (or find)
did you click on option the select 'within workbook' ?


--
mpeplow
------------------------------------------------------------------------
mpeplow's Profile: http://www.excelforum.com/member.php...o&userid=34812
View this thread: http://www.excelforum.com/showthread...hreadid=551942

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Find and Replace within workbook - from Visual basic

For example.....

Dim mySht As Worksheet

For Each mySht In Worksheets
mySht.Cells.Replace What:="Test", Replacement:="Fill", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Next mySht

HTH,
Bernie
MS Excel MVP


"MarkS" wrote in message
...
I need to find a string on a worksheet and change the formatting so it stands
out. That's easy. Actually, I want to find a bunch of strings on all
worksheets in a workbook. I recorded a macro that does the find and replace.
I selected the "options" button on the find and replace dialog box and
changed the "within" to "Workbook". Did the replace and it worked great.

However, the macro does NOT contain the code to change the option from
Worksheet to workbook! :-(

I imagine it's a one liner. Any idea what that is?



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
help for Visual Basic Find Lolly[_2_] Excel Programming 3 June 5th 06 04:16 AM
Using FIND in Visual Basic Mike Excel Programming 2 November 7th 05 05:01 PM
Where do I find help for Visual Basic for Applications Extensibili Lee Hunter Excel Programming 2 October 19th 05 05:39 PM
Using Find/Replace in Visual basic to adapt the code Zakynthos Excel Programming 6 September 8th 05 03:41 PM
How to hide a workbook and to detect a hidden workbook in visual basic jn1971[_3_] Excel Programming 0 May 5th 04 10:08 PM


All times are GMT +1. The time now is 07:07 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"