+ Reply to Thread
Results 1 to 5 of 5

Making some tabs calculate manually & others automatically?

Hybrid View

  1. #1
    Forum Contributor Big.Moe's Avatar
    Join Date
    03-15-2012
    Location
    Corea, Maine, USA
    MS-Off Ver
    Excel 2010
    Posts
    262

    Making some tabs calculate manually & others automatically?

    Is it possible to have some tabs in a workbook set on manual calculate mode and others on automatic?

    I have a workbook consisting of 20 tabs. 14 of the tabs are pretty much data entry tabs, 3 of the tabs are summary report pages, and lastly I have a few large helper tables on three "Calc" tabs that involve some volatile formulas. When the workbook is set to calculate automatically, the "Calc" tabs are causing a huge slow down.

    For the day to day operation of the workbook, only the 14 data entry tabs are used by the data entry person, but are hindered by the large calculation time involved with the "Calc" sheets. Setting the whole workbook to calculate manually cuts the calculation delay time, but makes the data entry process extremely difficult because the cells with formulas do not auto-populate.

    The ability to have some tabs calculate automatically, and others not, would be wonderful, but I don't know if that is possible.

    Any thoughts?

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Making some tabs calculate manually & others automatically?

    Hi Moe,

    Try this in the ThisWorkbook module:

    Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
    If Sh.Name Like "*Calc*" Then Exit Sub
    End Sub
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Contributor Big.Moe's Avatar
    Join Date
    03-15-2012
    Location
    Corea, Maine, USA
    MS-Off Ver
    Excel 2010
    Posts
    262

    Re: Making some tabs calculate manually & others automatically?

    Hi xladept,

    Hmmm....I may be doing something wrong, but the sheets keep calculating. Here are the three calculation sheets name: "REF CALCS", "ACCOUNTS CALCS", "OTHER CALCS". I just want to make sure your code will work with those sheet names.

    Just to be clear, I copied your code and pasted in the "ThisWorkbook" module. Then I turned calculations back to "Automatic", added a line item in one of the non-calcs sheets, and the calcs sheets auto-updated along with the rest of the workbook (which took a minute).

    Just as a test to make sure it's the three calc sheets in question, I deleted the three calc sheets and updated the workbook and it calculated in a second.

  4. #4
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Making some tabs calculate manually & others automatically?

    Quote Originally Posted by Big.Moe View Post
    Is it possible to have some tabs in a workbook set on manual calculate mode and others on automatic? [....| I have a few large helper tables on three "Calc" tabs that involve some volatile formulas. When the workbook is set to calculate automatically, the "Calc" tabs are causing a huge slow down.
    Have you considered ways to avoid or minimize the impact of the volatile functions? See my comments below.

    Be that as it may, the VBA procedures below demonstrate the operations that you are looking for.
    Sub disableSheet()
    ActiveSheet.EnableCalculation = False
    MsgBox ActiveSheet.Name & " False"
    End Sub
    
    Sub enableSheet()
    ActiveSheet.EnableCalculation = False
    ActiveSheet.EnableCalculation = True
    MsgBox ActiveSheet.Name & " True"
    End Sub
    
    Sub sheetStatus()
    MsgBox ActiveSheet.Name & " " & ActiveSheet.EnableCalculation
    End Sub
    If you experiment with those macros, you will find:

    1. When you run enableSheet() -- in Excel (not VBA), press alt+f8, select enableSheet, click Run -- the active worksheet is recalculated only if the application calculation mode is Automatic. Other worksheets are also recalculated, unless their calculation mode is disabled.

    2. When you run disableSheet(), the active worksheet is not recalculated.

    3. Note that enableSheet() first disables, then enables the worksheet calculation mode. This is prudent if you want to ensure that the worksheet is recalculated every time enableSheet() is run. enableSheet() triggers a recalculation cycle only when EnableCalculation transitions from False to True. If EnableCalculation is already True, simply setting EnableCalculation to True in enableSheet() does not trigger a recalculaion cycle.

    4. If you disable worksheet calculation, save the file, then re-open the file, EnableCalculation is True and the worksheet recalculates automatically by default.


    Quote Originally Posted by Big.Moe View Post
    Here are the three calculation sheets name: "REF CALCS", "ACCOUNTS CALCS", "OTHER CALCS".
    You might implement the following design....

    In the ThisWorkbook object, add the following procedure:
    Private Sub Workbook_Open()
    disableCalcSheets
    End Sub
    That ensures that EnableCalculation is False for the chosen worksheets and they are not recalculated when the workbook is opened.

    In a public module (not a worksheet object), add the following procedures:
    Const calcSheetNames As String = "REF CALCS,ACCOUNTS CALCS,OTHER CALCS"
    
    Sub disableCalcSheets()
    Dim nam As Variant
    For Each nam In Split(calcSheetNames, ",")
        Sheets(nam).EnableCalculation = False
    Next
    End Sub
    
    Sub enableCalcSheets()
    Dim nam As Variant
    For Each nam In Split(calcSheetNames, ",")
        Sheets(nam).EnableCalculation = False
        Sheets(nam).EnableCalculation = True
    Next
    End Sub
    You can manually run enableCalcSheets and disableCalcSheets while the workbook is open.

    -----

    PS.... Sorry, I forgot to add some comments about avoiding or minimizing the impact of volatile calculations, in the first place.

    A common mistake is to use whole-column ranges like A:A. That can have a major performance impact in both volatile and non-volatile formulas, especially in Excel 2007 and later. With rare exceptions, that causes Excel to process 1+ million rows.

    Unless you truly might have 1+ million rows of data, it is prudent to change such references to a reasonable shorter range, e.g. $A$1:$A$10000.

    Another common dubious design choice is the use of OFFSET and INDIRECT, which are volatile.

    Alternatively, consider using a range expression of the form INDEX(...):INDEX(...). Often, it makes the formula longer and messier. But it might be worthwhile to improve recalculation performance, since INDEX is not volatile.

    In some cases, CHOOSE might be a non-volatile alternative to INDIRECT.

    Those comments are just the tip of the iceberg. Refer to http://decisionmodels.com/calcsecrets.htm (click here).
    Last edited by joeu2004; 06-16-2017 at 10:18 AM. Reason: PS

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Making some tabs calculate manually & others automatically?

    Well maybe:

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    If Sh.Name Like "*Calc*" Then
    Application.Calculation = xlCalculationManual
    Else
    Application.Calculation = xlCalculationAutomatic
    End If: End Sub

+ 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. [SOLVED] Close userform manually even though there is another that closes automatically.
    By countryfan_nt in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-06-2016, 11:45 PM
  2. Creating TABS from a list and have these tabs have information populate automatically
    By clpickett3 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-07-2016, 03:35 AM
  3. [SOLVED] How can I automatically insert this source code into new tabs or all Tabs?
    By Chad Bateman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-01-2015, 06:42 PM
  4. A manually entered cell to automatically update another manually entered cell
    By Head Scratcher in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-29-2013, 08:23 PM
  5. Manually Calculate Several Sheets
    By Fursmanm in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-20-2012, 09:52 AM
  6. Advanced Filter is working manually but not automatically
    By rwgrietveld in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-28-2010, 08:54 AM
  7. How do I manually calculate this formula PV(P3/1200,Q3,-N3*M3/100
    By Claressa in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-09-2005, 02:30 PM

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