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
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
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" <[email protected]> wrote in message
news:[email protected]...
> 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
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" <[email protected]> wrote in message
> news:[email protected]...
> > 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
>
>
>
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" <[email protected]> wrote in message
> news:[email protected]...
> > 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
>
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks