在打开和closuresapplication.screenupdating的同时更新打开的Excel工作表上的单元格

这是一个很大的macros观问题,我正在通过日志文件进行阅读,并通过将数据写入大量工作表来准备数据。 我不想看到所有的这些文字都在进行,所以我closures了屏幕更新,但是我希望看到一些进展,所以我每隔一段时间切换屏幕更新,激活顶部工作表,在一些文件中写入一些进度数据单元格和开关屏幕再次更新。 这在Excel 2010中运行得非常好,但是上周我升级到了Excel 2013,没有更多可见的macros直到macros完成。 我添加了一个0.3秒的暂停,但现在只有时间得到更新,而不是处理网站的数量。 有任何想法吗?

Application.ScreenUpdating = True 'To write the elapsed time and the number of found sites on the performance monitor sheet PerfMon.Activate PerfMon.Range("B4") = Now - StartPoint PerfMon.Range("D4") = SiteCnt Application.Wait (Now + (0.3 / 86400)) Application.ScreenUpdating = False 

谢谢,汉斯

最好的解决scheme似乎是启用状态栏。 不知道你的macros是什么,我build议你在工作簿中设置一个variables作为一个整数,并跟踪状态栏中的当前进度。 也许这是“现在 – StartPoint”或“SiteCnt”,否则你可以周期性地用新的文本更新状态栏。

如果你使用整数选项,这里是一个例子:

 [...] Application.ScreenUpdating = False Application.DisplayStatusBar = True Dim i As Integer For i = 2 To Sheets.Count ' example from my macro but you could use any repeating process Worksheets(i).Activate Application.StatusBar = "Updating Filings for " & ( i - 1 ) & " of " & (Sheets.Count - 1) & " | " & Format (( i - 1 )) / (Sheets.Count - 1), "0%") & "Complete" Next i Application.StatusBar = "" Application.DisplayStatusBar = False [...] 

如果你使用文本选项,这里是一个例子:

 [...] Application.ScreenUpdating = False Application.DisplayStatusBar = True Application.StatusBar = "Reading log files" [...] Application.StatusBar = "Preparing data" [...] Application.StatusBar = "Formatting data" [...] Application.StatusBar = "" Application.DisplayStatusBar = False [...]