vba - VBA 和 Bloomberg 应用程序。运行“RefreshAllWorkbooks”
问题描述
请就以下事项提出建议:
我有一个代码应该刷新我的工作簿中的公式,然后将结果作为值复制到另一张表。问题是代码会直接遍历所有内容并在刷新完成之前复制数据(刷新大约需要 10-15 秒)。
我使用了以下(及其品种),但它没有做任何事情来减慢它:
Application.Wait (Now + TimeValue("0:00:15"))
我是否必须执行一个循环来检查单元格内容并在识别单元格更新后执行“复制”部分?
Sub Excel_VBA_Timer_Event1()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim V As Workbook: Dim x, y, z As Worksheet
Set V = ThisWorkbook: Set x = V.Sheets(1): Set y = V.Sheets(2): Set z = V.Sheets(3)
z.Columns("A:O").EntireColumn.Delete
Aplication.Run "RefreshAllWorkbooks"
'WAIT HERE for approx 15 seonds
'At the moment the code flies through till the end before Bloomberg formulas are refreshed
y.Columns("C:M").Copy
z.Range("A1").PasteSpecial (xlPasteValues): z.Range("A1").PasteSpecial (xlPasteFormats)
z.Activate: z.Cells(1, 1).Select
Application.CutCopyMode = False
MsgBox "Done"
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
解决方案
推荐阅读
- wordpress - 如何让所有评论类型显示在 WordPress 中?
- python - TensorFlow matmul如何处理channel=None
- ajax - Codeigniter Ajax 记录已保存但不显示 luvr
- c - 如何使scanf不忽略C中的空格和\ n
- javascript - 这段代码有什么问题?我正在尝试在 Angular 中移动 TS 中的 JS 代码
- python - MinMax 缩放数组,具有整个数组的最大值和最小值
- schema.org - 自定义帖子档案和自定义分类档案的 Schema.org 标记?
- javascript - 将 JSONified 对象传递到 Django 中的后端?
- asp.net - 使用 linq 查找出现在两个列表中的项目
- java - 如何在 Firebase 中创建类似的功能?