+ Reply to Thread
Results 1 to 4 of 4

Replace Values in range selection

Hybrid View

Guest Replace Values in range... 12-27-2005, 05:35 PM
Guest Re: Replace Values in range... 12-27-2005, 05:45 PM
Guest Re: Replace Values in range... 12-27-2005, 08:30 PM
Guest RE: Replace Values in range... 12-27-2005, 06:30 PM
  1. #1
    Terri
    Guest

    Replace Values in range selection

    Hello,
    I have Cells E3:AE77 selected. How can I assess each cell in the range
    selected and if the cell value is >0 then change the cell value to 0. Also,
    how do I have the macro stop after all the cells in the range have been
    assessed.

    Thank you all for your help!

    Terri

  2. #2
    Bob Phillips
    Guest

    Re: Replace Values in range selection

    For Each cell In Range("E3:AE77")
    If cell.Value > 0 Then cell.Value = 0
    Next cell

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Terri" <Terri@discussions.microsoft.com> wrote in message
    news:DB16B564-B2F5-42A0-BC50-7124E553EA53@microsoft.com...
    > Hello,
    > I have Cells E3:AE77 selected. How can I assess each cell in the range
    > selected and if the cell value is >0 then change the cell value to 0.

    Also,
    > how do I have the macro stop after all the cells in the range have been
    > assessed.
    >
    > Thank you all for your help!
    >
    > Terri




  3. #3
    Terri
    Guest

    Re: Replace Values in range selection

    Bob & "Gary's Student",
    Both suggestions worked perfectly. Thank you both so much for the help and
    for getting me on the right path to other ways to use this code. Thanks
    again!

    Terri

    "Bob Phillips" wrote:

    > For Each cell In Range("E3:AE77")
    > If cell.Value > 0 Then cell.Value = 0
    > Next cell
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Terri" <Terri@discussions.microsoft.com> wrote in message
    > news:DB16B564-B2F5-42A0-BC50-7124E553EA53@microsoft.com...
    > > Hello,
    > > I have Cells E3:AE77 selected. How can I assess each cell in the range
    > > selected and if the cell value is >0 then change the cell value to 0.

    > Also,
    > > how do I have the macro stop after all the cells in the range have been
    > > assessed.
    > >
    > > Thank you all for your help!
    > >
    > > Terri

    >
    >
    >


  4. #4
    Gary''s Student
    Guest

    RE: Replace Values in range selection

    Enter this small macro:

    Sub Macro1()
    Dim r As Range
    For Each r In Selection
    If r.Value > 0 Then
    r.Value = 0
    End If
    Next
    End Sub

    Select any range of cells and run the macro.
    --
    Gary''s Student


    "Terri" wrote:

    > Hello,
    > I have Cells E3:AE77 selected. How can I assess each cell in the range
    > selected and if the cell value is >0 then change the cell value to 0. Also,
    > how do I have the macro stop after all the cells in the range have been
    > assessed.
    >
    > Thank you all for your help!
    >
    > Terri


+ 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