+ Reply to Thread
Results 1 to 7 of 7

Macro to create sum formula across all sheets except one activated in

  1. #1
    Registered User
    Join Date
    04-20-2015
    Location
    USA
    MS-Off Ver
    2010
    Posts
    51

    Macro to create sum formula across all sheets except one activated in

    Hello all

    Let me give some background. I have a summary tab that will be in about 200 workbooks. The summary sheet is independent in each workbook but all tabs are exactly the same throughout all sheets and all workbooks..

    I am looking for a macro that will create a formula that sums across all the tabs in a single workbook. Each summary page has 6000 cells that need to be summed and the remaining cells need to be untouched since there will be formulas sitting in the summary tab that is based of the summed numbers.

    e.g. for one workbook that has 3 tabs SRC RCS and CRS and Summary, I want a macro that will put =sum('SRS'C!20!+'RCS'C!20!+'CRS'C!20!) in C20 of the summary tab. I want the macro to work as a range so that it will create this sum formula for C20:Q20 and create the formula for the corresponding cell in the rest of the sheets.

    Is this possible? I've been racking my head and can't think of anything.
    Last edited by SAFC; 09-22-2015 at 10:28 AM.

  2. #2
    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
    53,048

    Re: Macro to create sum formula across all sheets except one activated in

    Why do you need a macro for this?
    Is the formula changing all the time?
    Do you just want to "punch" a formula through to all sheets?
    Can you upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    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

  3. #3
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Macro to create sum formula across all sheets except one activated in

    Hi SAFC,

    You can use 3D formulas in this case - the following will sum cell C20 from sheet SRC to CRS including all the sheets between (sheet RCS in this case):

    =SUM(SRC:CRS!C20)

    HTH

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  4. #4
    Registered User
    Join Date
    04-20-2015
    Location
    USA
    MS-Off Ver
    2010
    Posts
    51
    The number of sheets and the name of the sheets change between each workbook. Sorry I meant to clarify that.

  5. #5
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Macro to create sum formula across all sheets except one activated in

    Just change my 3D formula above to suit.

    Note for 3D formulas it's vital how the sheets are ordered for them to produce the results you want - i.e. have the Summary sheet as the first (furthest left) tab followed by the first tab you wish to sum from to the last (furthest right) tab you want to sum to.

  6. #6
    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
    53,048

    Re: Macro to create sum formula across all sheets except one activated in

    Quote Originally Posted by SAFC View Post
    The number of sheets and the name of the sheets change between each workbook. Sorry I meant to clarify that.
    Doesnt necessarily matter.
    if you add a blank worksheet at the start and end of your data sheets, and call them Start and End, then when you enter your calcs, you could just enter =sum('start:End'!C12) or whatever your references are. this way, you can add or remove sheets as needed, and it will add across all the sheets you need it to, and keep the totals as the data sheets change. make sure your "Master" sheet is before the Start sheet though

  7. #7
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Macro to create sum formula across all sheets except one activated in

    Yes, and it may be worth protecting those sheets as if they end up getting populated the figures could appear in your totals (if entered in a cell your referencing).

+ 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. Macro activated by pwd
    By graiggoriz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-05-2014, 03:56 AM
  2. Create Macro to move values from the current sheet in which the macro is activated
    By Turkish1801 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-06-2013, 06:11 PM
  3. Replies: 2
    Last Post: 09-19-2013, 04:22 AM
  4. [SOLVED] Macro/s to create Search Bar to filter to search terms entered activated by Command Button
    By JasonRay in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-08-2013, 03:44 PM
  5. Macro activated from multiple sheets causing mixed results
    By Beau Burton in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-21-2012, 11:59 PM
  6. [SOLVED] Macro copying values and sheet names of all activated sheets
    By Rosixks in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-07-2011, 06:16 PM
  7. how do I create event-activated macros that check every cell?
    By JLC in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-29-2005, 01:10 PM

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