我的目的是更新彭博数据并用不同的代号进行一些计算。但似乎VBA将运行所有计算而不等待数据更新。 下面是代码:VBA刷新彭博数据未按正确顺序运行
Application.Calculation = xlCalculationAutomatic
For i = 1 To 3
Call Worksheets("Sheet1").Range("data1").Select 'the cells "data1" contains the function =BDH(ticker, field, start date, end date) to get the information from Bloomberg'
Call Application.Run("RefreshCurrentSelection")
Worksheets("sheet1").Range("d3").Value = Worksheets("sheet1").Range("sum") 'the cells "sum" takes the sum of all BB info'
任何人都知道如何解决它,好吗?非常感谢你!
'RefreshCurrentSelection'异步运行,所以不起作用。 – assylias