Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Cells.Replace in VBA

How do I specify workbook rather than sheet in Cells.Replace in VBA:

Cells.Replace What:="x", Replacement:="y", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
--
Gary''s Student
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Cells.Replace in VBA

You don't. You can repeat the command on each sheet.

for each sh in Activeworkbook
sh.Activate
cells.Replace . . .
Next


--
Regards,
Tom Ogilvy

"Gary''s Student" wrote in message
...
How do I specify workbook rather than sheet in Cells.Replace in VBA:

Cells.Replace What:="x", Replacement:="y", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
--
Gary''s Student



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Cells.Replace in VBA

Thank you . I now understand why the Macro Recorder generated the same code
either way.
--
Gary''s Student


"Tom Ogilvy" wrote:

You don't. You can repeat the command on each sheet.

for each sh in Activeworkbook
sh.Activate
cells.Replace . . .
Next


--
Regards,
Tom Ogilvy

"Gary''s Student" wrote in message
...
How do I specify workbook rather than sheet in Cells.Replace in VBA:

Cells.Replace What:="x", Replacement:="y", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
--
Gary''s Student




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cells.Replace in VBA

I use the same thing but it impossible to control it on the sheet or on the
Workbook.

If you used manually the search and replacement command before the sub in
the workbook, the sub work for all sheets.

If you used manually in a sheet, the sub work for this sheet only.

The option for sheet or workbook seem not writable. My question is how is
possible to write my choice.

Sorry for my english, I am french.

"Tom Ogilvy" wrote:

You don't. You can repeat the command on each sheet.

for each sh in Activeworkbook
sh.Activate
cells.Replace . . .
Next


--
Regards,
Tom Ogilvy

"Gary''s Student" wrote in message
...
How do I specify workbook rather than sheet in Cells.Replace in VBA:

Cells.Replace What:="x", Replacement:="y", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
--
Gary''s Student




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
replace ' in cells Suz771 Excel Discussion (Misc queries) 4 April 3rd 10 03:33 AM
Find and Replace 2 cells NOOBY92 Excel Discussion (Misc queries) 4 April 10th 07 02:08 AM
Checking the Cells in Sheet1 with Cells in Sheet2 and replace Checking the cells in Sheet1 with Sheet2 Excel Worksheet Functions 1 August 19th 06 09:29 AM
How to find multiple cells/replace whole cells w/data dcurylo Excel Discussion (Misc queries) 2 November 30th 05 08:06 PM
Replace over two cells Steve Wylie Excel Programming 2 September 1st 03 12:53 PM


All times are GMT +1. The time now is 01:42 PM.

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"