Formulas not updating if the other work book is closed

前端 未结 3 1191
执笔经年
执笔经年 2021-01-16 09:01

I have the below formula which makes reference to another workbook in the same folder but when the file is open it just works fine, the problem is when the other excel file

3条回答
  •  旧巷少年郎
    2021-01-16 09:22

    Excel Functions like COUNTIFS and SUMIFS does not recalculate when referenced to closed workbook. You could try using Excel Query Designer which work like ADO codes. Allows retrieval from closed books, db etc. Hope this helps.

    the simplest way to achieve this without using advanced tools will be to use the code below to open the file, do the calculation and close the file back. Not sure if this help. Please change the 'H:\My Documents\4674576.xlsx' to your source file path. Paste this code in new module of your excel workbook. run the code and see if this helps.

    Sub loadfileandCalc() Dim acWb As Workbook Dim wb As Workbook Set wb = Workbooks.Open(Filename:="H:\My Documents\4674576.xlsx", UpdateLinks:=False, ReadOnly:=True) Set acWb = ActiveWorkbook ActiveSheet.Calculate Set acWb = Nothing wb.Close False Set wb = Nothing

    End Sub

提交回复
热议问题