+ Reply to Thread
Results 1 to 4 of 4

Cells.Replace in VBA

  1. #1
    Gary''s Student
    Guest

    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. #2
    Tom Ogilvy
    Guest

    Re: 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" <[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




  3. #3
    Gary''s Student
    Guest

    Re: 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" <[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

    >
    >
    >


  4. #4
    Jackes
    Guest

    Re: 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" <[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

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1