+ Reply to Thread
Results 1 to 5 of 5

Replacing spaces with zeros

Hybrid View

Guest Replacing spaces with zeros 05-16-2006, 07:55 AM
Guest Re: Replacing spaces with... 05-16-2006, 07:55 AM
Guest Re: Replacing spaces with... 05-16-2006, 09:10 AM
Guest RE: Replacing spaces with... 05-16-2006, 08:10 AM
Guest RE: Replacing spaces with... 05-16-2006, 08:10 AM
  1. #1
    Oldjay
    Guest

    Replacing spaces with zeros

    I have the following

    Sub FillZeros()

    Sheets("Records").Select
    Range("N2:N500").Select
    Application.CutCopyMode = False
    Cells.Replace What:="", Replacement:=0, LookAt:=xlPart, SearchOrder _
    :=xlByRows, MatchCase:=False

    End Sub

    When I run it I get 5 additional cols of zeros

    Oldjay

  2. #2
    Ardus Petus
    Guest

    Re: Replacing spaces with zeros

    Try: Selection.Replace instead of Cells.Replace

    HTH
    --
    AP

    "Oldjay" <Oldjay@discussions.microsoft.com> a écrit dans le message de news:
    4E931E83-9C3F-4134-928C-CB853C867CED@microsoft.com...
    >I have the following
    >
    > Sub FillZeros()
    >
    > Sheets("Records").Select
    > Range("N2:N500").Select
    > Application.CutCopyMode = False
    > Cells.Replace What:="", Replacement:=0, LookAt:=xlPart, SearchOrder _
    > :=xlByRows, MatchCase:=False
    >
    > End Sub
    >
    > When I run it I get 5 additional cols of zeros
    >
    > Oldjay




  3. #3
    Oldjay
    Guest

    Re: Replacing spaces with zeros

    Thanks everybody

    "Ardus Petus" wrote:

    > Try: Selection.Replace instead of Cells.Replace
    >
    > HTH
    > --
    > AP
    >
    > "Oldjay" <Oldjay@discussions.microsoft.com> a écrit dans le message de news:
    > 4E931E83-9C3F-4134-928C-CB853C867CED@microsoft.com...
    > >I have the following
    > >
    > > Sub FillZeros()
    > >
    > > Sheets("Records").Select
    > > Range("N2:N500").Select
    > > Application.CutCopyMode = False
    > > Cells.Replace What:="", Replacement:=0, LookAt:=xlPart, SearchOrder _
    > > :=xlByRows, MatchCase:=False
    > >
    > > End Sub
    > >
    > > When I run it I get 5 additional cols of zeros
    > >
    > > Oldjay

    >
    >
    >


  4. #4
    Stefi
    Guest

    RE: Replacing spaces with zeros

    > Cells.Replace What:="", Replacement:=0, LookAt:=xlPart, SearchOrder _
    > :=xlByRows, MatchCase:=False


    This statement replaces empty strings "".

    Try

    > Cells.Replace What:=" ", Replacement:=0, LookAt:=xlPart, SearchOrder _
    > :=xlByRows, MatchCase:=False


    but first check that you want to replace all spaces in all cells
    (LookAt:=xlPart) or only those standing alone in a cell (LookAt:=xlWhole)

    Regards,
    Stefi

    „Oldjay” ezt Ã*rta:

    > I have the following
    >
    > Sub FillZeros()
    >
    > Sheets("Records").Select
    > Range("N2:N500").Select
    > Application.CutCopyMode = False
    > Cells.Replace What:="", Replacement:=0, LookAt:=xlPart, SearchOrder _
    > :=xlByRows, MatchCase:=False
    >
    > End Sub
    >
    > When I run it I get 5 additional cols of zeros
    >
    > Oldjay


  5. #5
    Tom Ogilvy
    Guest

    RE: Replacing spaces with zeros


    Sub FillZeros()

    Sheets("Records").Select
    Range("N2:N500").Select
    Application.CutCopyMode = False
    Selection.Replace What:="", Replacement:=0, LookAt:=xlPart, SearchOrder _
    :=xlByRows, MatchCase:=False

    End Sub
    --
    Regards,
    Tom Ogilvy


    "Oldjay" wrote:

    > I have the following
    >
    > Sub FillZeros()
    >
    > Sheets("Records").Select
    > Range("N2:N500").Select
    > Application.CutCopyMode = False
    > Cells.Replace What:="", Replacement:=0, LookAt:=xlPart, SearchOrder _
    > :=xlByRows, MatchCase:=False
    >
    > End Sub
    >
    > When I run it I get 5 additional cols of zeros
    >
    > Oldjay


+ 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