+ Reply to Thread
Results 1 to 3 of 3

Values calculated by formulas disappear (are zeroed) on workbook window deactivate

  1. #1
    Registered User
    Join Date
    03-15-2023
    Location
    Poprad
    MS-Off Ver
    365
    Posts
    2

    Values calculated by formulas disappear (are zeroed) on workbook window deactivate

    Hello excel experts,

    I am intentionally setting Calculations to Manual when specific worksheet in my workbook are activated (using Worksheet_Activate event and Application.Calculation = xlCalculationManual code). As I want to ensure that once I activate other workbooks Calculations are set to Automatic. Which works perfectly fine either using Workbook_Deactivate or Workbook_WindowDeactivate event and running Application.Calculation = xlCalculationAutomatic code. The only problem is that some formulas stop working e.g. this one

    =INDEX(tblLabourRates, MATCH(D5&"Cost-plus"&C5,tblLabourRates[Country]&tblLabourRates[Rate type]&tblLabourRates[Currency],0), MATCH(TEXT(E5,"0"),tblLabourRates[#Headers],0))*F5*WORKDAYHOURS(D5)

    calculationsdisapear.png

    Initially i though values are zeroed, which was the case but it's result of IFERROR function. I have removed IFERROR from one cell (see top right cell on the screenshot) and obviously formula above stops working.

    Other fomula e.g. =IF('EFFORT ESTIMATES'!$A611<>"0",SUMIF('EFFORT ESTIMATES'!$S$609:OFFSET('EFFORT ESTIMATES'!$S$609,,rscProjectWeeks+2),'P&L'!$C$103,'EFFORT ESTIMATES'!$S611:OFFSET('EFFORT ESTIMATES'!$S611,,rscProjectWeeks+2)),0) keeps working.

    Attached picture for illustration and the code which is "problematic" . If that code is not used all formulas keeps working. Thanks in advance for advice. Tomas

    Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
    Application.Calculation = xlCalculationAutomatic
    End Sub
    Attached Images Attached Images
    Last edited by lossoss; 04-06-2023 at 03:24 AM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,453

    Re: Values calculated by formulas disappear (are zeroed) on workbook window deactivate

    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Registered User
    Join Date
    03-15-2023
    Location
    Poprad
    MS-Off Ver
    365
    Posts
    2

    Re: Values calculated by formulas disappear (are zeroed) on workbook window deactivate

    Thanks Pepe for having look. I was fighting with the problem further and when I added following code:

    Sheet.EnableCalculation = False

    to Workbook_WindowDeactivate subprocedure and it did a trick. Now values are calculated by all formulas and they stay visible when workbook deactivated. Obviously it's because sheet is not being calculated when workbook windows is not active, which is not a problem for me.

    Sheet.EnableCalculation = False

+ 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. Replace formulas with their calculated values
    By salmasaied in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2019, 09:56 AM
  2. Replace All Formulas with VBA Calculated Values
    By hamidxa in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-07-2016, 03:32 PM
  3. Summarizing Data by removing zeroed values
    By Coxy347 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-11-2015, 10:54 PM
  4. [SOLVED] Deactivate Split Window
    By Pierce Quality in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-07-2014, 01:48 PM
  5. [SOLVED] Sheet tabs disappear when workbook window protected.
    By dzugan in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 11-24-2013, 03:00 AM
  6. Values calculated by formulas are not summing
    By retcgr in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-31-2012, 02:59 PM
  7. [SOLVED] Formulas disappear from cell and keeps values only
    By gmgree in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-20-2012, 11:07 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