Cells.Replace in VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
You don't. You can repeat the command on each sheet.

for each sh in Activeworkbook
sh.Activate
cells.Replace . . .
Next
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top