最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Worksheets("Sheet1").UsedRange.Calculate is not working when calculations are set to Manual in Excel VBA - Sta

programmeradmin4浏览0评论

I have a number of spreadsheets written with VBA code in the background that that rely on iterative calculations until a solution is found. These worked fine up until around the 11th of February 2025. Since then the Worksheets("Sheet1").UsedRange.Calculate has not been working. I have to set the workbook up to Application.Calculation = xlManual, otherwise some of my calculations can become unstable. I have then been cascading the calculations across the sheets in a specific order to allow the data to flow through.

In simple terms my problem is that if I open a new workbook and for example set cell A1 to =B1 and cell B1 to =A1+1. This should increment the values every time I recalculate the sheet. Indeed if I F9 it does. However, when the workbook is set to: Application.Calculation = xlManual, though F9 still works Worksheets("Sheet1").UsedRange.Calculate does not. Please see my test code below including comments.

Sub TestCalculate()
Worksheets("Sheet1").UsedRange.Calculate 'Now only works when Automatic Calculations are enabled.`  
'Application.Calculate 'Works fine with or without Automatic Calculation enabled but calculates the whole workbook which is not what I need.`
End Sub

I feel like this maybe linked to an Office 365 update as I cannot understand why else it would stop working but am reluctant to roll back the version and have this problem reappear later. Any help would be greatly appreciated. Many Thanks

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论