Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7799613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:22:05+00:00 2026-06-02T00:22:05+00:00

I have an Excel workbook in which I have tabs representing dates along with

  • 0

I have an Excel workbook in which I have tabs representing dates along with sum in each tab. Although I can take the sum of all these in the final sheet, I want a formula/macro to get the sum in the total named sheet, when a new spreadsheet is being added.

Note:- the cell in all would remain the same (E56)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T00:22:08+00:00Added an answer on June 2, 2026 at 12:22 am

    I do not understand what you are attempting. Until the user has placed information in the new sheet that results in a value in E56, I see little point to adding the value of NewSheet!E56 to the total sheet.

    However I suspect you need to use events. Below are a number of event routines which must be placed in the Microsoft Excel Object ThisWorkbook for the workbook. These just output to the Immediate window so you can see when they are fired. Note: several can be fired for one user event. For example, creating a new worksheet, triggers: “Create for new sheet”, “Deactivate for old sheet” and “Activate for new sheet”.

    Do not forget to include

        Application.EnableEvents = False
    
        Application.EnableEvents = True
    

    around any statement within one of these routine that will trigger an event.

    Perhaps you need to use SheetDeactivate. When the users leaves a sheet, check for a value in E56. If present, check for its inclusion in the totals sheet. Have a play. Do what your users do. Add to these routines to investigate further. Good luck.

    Private Sub Workbook_SheetActivate(ByVal Sh As Object)
    
      Debug.Print "Workbook_SheetActivate " & Sh.Name
    
    End Sub
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    
       Call MsgBox("Workbook_BeforeClose", vbOKOnly)
    
    End Sub
    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Source As Range)
    
      Debug.Print "Workbook_SheetChange " & Sh.Name & " " & Source.Address
    
    End Sub
    Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
    
      Debug.Print "Workbook_SheetDeactivate " & Sh.Name
    
    End Sub
    Private Sub Workbook_NewSheet(ByVal Sh As Object)
    
      Debug.Print "Workbook_NewSheet " & Sh.Name
    
    End Sub
    Sub Workbook_Open()
    
       Debug.Print "Workbook_Open"
    
    End Sub
    

    Extra section in response to clarification of requirement

    The code below recalculates the grand total of cell E56 for all worksheets except TOTAL and stores the result in worksheet TOTAL every time the workbook is opened and every time the user changes the current worksheet.

    It is difficult to get consistent timings with Excel but according to my experimentation you would need between 500 and 1,000 worksheets before the user would notice a delay switching worksheets because of this recalculation.

    I am not sure if you know how to install this code so here are brief instructions. Ask if they are too brief.

    • Open the relevant workbook.
    • Click Alt+F11. The VBA editor displays. Down the left you should see the Project Explorer. Click Ctrl+R if you do not. The Project Explorer display will look something like:

    .

    VBAProject (Xxxxxxxx.xls)
        Microsoft Excel Objects
           Sheet1 (Xxxxxxxxx)
           Sheet10 (Xxxxxxxxx)
           Sheet11 (Xxxxxxx)
           :
           ThisWorkbook
    
    • Click ThisWorkbook. The top right of the screen with turn white.
    • Copy the code below into that white area.
    • No further action is required. The macros Workbook_Open() and Workbook_SheetDeactivate() execute automatically when appropriate.

    Good luck.

    Option Explicit
    
    Sub CalcAndSaveGrandTotal()
    
      Dim InxWksht As Long
      Dim TotalGrand As Double
    
      TotalGrand = 0#
      For InxWksht = 1 To Worksheets.Count
        If Not UCase(Worksheets(InxWksht).Name) = "TOTAL" Then
          ' This worksheet is not the totals worksheet
          If IsNumeric(Worksheets(InxWksht).Range("E56").Value) Then            '###
            TotalGrand = TotalGrand + Worksheets(InxWksht).Range("E56").Value
          End If                                                                '###
        End If
      Next
    
      'Write grand total to worksheet TOTAL
      ' ##### Change the address of the destination cell as required  
      Worksheets("TOTAL").Range("D6").Value = TotalGrand
    
    End Sub
    Sub Workbook_Open()
    
      ' The workbook has just been opened.
    
       Call CalcAndSaveGrandTotal
    
    End Sub
    Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
    
      ' The user has selected a new worksheet or has created a new worksheet.
    
       Call CalcAndSaveGrandTotal
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Excel workbook which I want to scroll through the contents of
I have an Excel Workbook which has some VSTO-based c# code. Given a known
I have a VSTO Excel workbook that functions correctly in test. I can deploy
I have a bunch of Excel.Name objects under Workbook.Names collection which contain invalid references.
I have an excel workbook in which there is data from multiple text files.
I have some VBA code in an Excel workbook. I have a cell which
I have an Excel 2007 workbook which I am using to connect to a
I have a Vsto Excel workbook (created in Visual Studio) which also contains a
I have a Vsto Excel workbook (created in Visual Studio) which also contains a
I have an Excel workbook, which using VBA code that opens another workbook, copies

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.