+ Reply to Thread
Results 1 to 6 of 6

Summing Cells in VBA without entering a formula?

  1. #1
    Registered User
    Join Date
    02-18-2020
    Location
    London
    MS-Off Ver
    2010
    Posts
    75

    Summing Cells in VBA without entering a formula?

    Hello

    Please help with this probably simple problem...

    I'd like to sum a fixed range of cells in a VBA Macro and so tried the following:

    Range("A15").Formula ="=Sum(A1:A14)"

    This works but permanently adds the formula "=Sum(A1:A14)" into the cell A15, whereas as I just want the numerical result in the cell. (So that after the Macro has been run, if any values in A1:A14 are changed by the user the value in A15 remains the same)

    What VBA code should I use please?

    Thanks
    Robin

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Summing Cells in VBA without entering a formula?

    Please Login or Register  to view this content.
    Also, remember to post code via code tags...
    Highlight code and press #
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,910

    Re: Summing Cells in VBA without entering a formula?

    Or:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-18-2020
    Location
    London
    MS-Off Ver
    2010
    Posts
    75

    Re: Summing Cells in VBA without entering a formula?

    Thanks, that works perfectly.

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Summing Cells in VBA without entering a formula?

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Tx for re
    p +

  6. #6
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Summing Cells in VBA without entering a formula?

    Or, if your range is truly "fixed" (meaning "unchanging") as you say in Message #1, then this will also work...

    [A15] = [Sum(A1:A14)]
    Last edited by Rick Rothstein; 04-28-2020 at 07:51 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 04-06-2016, 12:19 PM
  2. Entering a formula in all the cells of a table
    By Masquerouge in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-15-2013, 04:10 PM
  3. [SOLVED] Entering a formula into a cell using cells from a named range
    By davidrias in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-03-2013, 06:58 PM
  4. Adding a row at the end of a 'category' and entering formula for summation
    By lovi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-05-2012, 12:05 PM
  5. Entering and Adding Time
    By Sandy Mann in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 04:05 AM
  6. [SOLVED] Entering and Adding Time
    By Ron737 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM
  7. Entering Formula into Merge Cells Question
    By artemisia in forum Excel General
    Replies: 1
    Last Post: 06-10-2005, 10:54 AM

Tags for this Thread

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