+ Reply to Thread
Results 1 to 5 of 5

I need a macro that will reset cells to zero

  1. #1
    Macro Beginner
    Guest

    I need a macro that will reset cells to zero

    Does anyone have something I could use for the above?

  2. #2
    Tom Ogilvy
    Guest

    Re: I need a macro that will reset cells to zero

    If the cells in question have formulas, then you would need to alter the
    input cells so that the formulas calculated to zero. If you want any cell
    containing a numeric constant to be zero

    Sub Resettozero()
    Activesheet.usedrange.Specialcells(xlConstants,xlNumber).Value = 0
    End Sub

    --
    Regards,
    Tom Ogilvy
    "Macro Beginner" <Macro [email protected]> wrote in message
    news:[email protected]...
    > Does anyone have something I could use for the above?




  3. #3
    sebastienm
    Guest

    RE: I need a macro that will reset cells to zero

    Hi,

    Dim Rg As range
    set rg=range("A1:A10")

    'To assign Zero (0) ... or any other value to whole range:
    Rg.Value= 0

    'To clear the range and make it Empty:
    'Rg.ClearContents

    --
    Regards,
    Sébastien
    <http://www.ondemandanalysis.com>


    "Macro Beginner" wrote:

    > Does anyone have something I could use for the above?


  4. #4
    Registered User
    Join Date
    04-02-2019
    Location
    Tauranga New Zealand
    MS-Off Ver
    2016
    Posts
    4

    Re: I need a macro that will reset cells to zero

    Hi Bastien.
    I have formulas in those cells.
    How can I do the same thing reset to zero but keep my formulas.
    Andrew

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: I need a macro that will reset cells to zero

    Quote Originally Posted by A Matt View Post
    Hi Bastien.
    I have formulas in those cells.
    How can I do the same thing reset to zero but keep my formulas.
    Andrew
    Perhaps you missed that this thread is over 15 years old? I doubt anyone is still following it.

    Also, Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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