Excel VBA进度/状态栏
今天我试着学习vba进度条/状态条,我在vba代码中添加了下面的代码,想在调用两个宏时显示状态条,但我没有工作,没有错误,出现了msgbox'done',两个应该运行的宏也没有执行;有人知道代码出了什么问题吗?多谢各位Excel VBA进度/状态栏,excel,vba,Excel,Vba,今天我试着学习vba进度条/状态条,我在vba代码中添加了下面的代码,想在调用两个宏时显示状态条,但我没有工作,没有错误,出现了msgbox'done',两个应该运行的宏也没有执行;有人知道代码出了什么问题吗?多谢各位 Sub LOOP_GENERATEREPORT() Dim I As Integer Dim loopRng As RANGE Dim r As RANGE '----progress bar Dim x As Integer Dim MyTimer As Double '--
Sub LOOP_GENERATEREPORT()
Dim I As Integer
Dim loopRng As RANGE
Dim r As RANGE
'----progress bar
Dim x As Integer
Dim MyTimer As Double
'------/progress bar
Application.ScreenUpdating = False
Sheet10.Activate
y = Sheet10.RANGE("a24").Value
For I = 1 To lastRow
'---------progress bar
Application.StatusBar = False
'----------/progress bar
For Each r In Sheet10.RANGE("a26", RANGE("a" & Rows.Count).End(xlUp))
Sheet2.RANGE("ae8").Value = r.Value
Set loopRng = Worksheets("setting").RANGE("a24")
ActiveWindow.ScrollRow = loopRng
Application.CutCopyMode = False
Application.DisplayAlerts = True
Application.ScreenUpdating = False
' ---------progress bar
Application.StatusBar = "SMART Report printing in progress, please wait..." & I & " of " & y + 0 & " or " & Format((I - 1) / y, "0.00%") & "."
Call convertformula
Call CopySummaryRow44
Next r
Next I
'---------progress bar
Application.StatusBar = True
'----------/progress bar
Sheet2.Activate
MsgBox "DONE"
Sheet2.RANGE("ae8").Select
End Sub
Application.StatusBar=False
中的False
错误:您应该提供字符串,例如
Application.StatusBar = "False" ' to display "False"
或
等等。知道当前结果会有帮助吗?您是否收到任何错误消息?考虑使用这里的指导来编辑您的问题:在运行宏之后,MsgBox“完成”出现了。发生了什么事?为了你的指导,我修改了我的问题。正确地缩进你的代码。您可以为此使用RubberDuck COM加载项。请参见此处:避免使用。选择“请参见此处”。完全限定您正在引用的内容,例如ThisWokbook.Sheets(“Sheet10”)。将变量y声明为Long,并将选项显式放置在模块顶部,以便拾取任何输入错误。这些是一些直接的想法。确保您有Application.DisplayStatusBar=True,并将其放在Application.screenUpdate=False之后。去掉你设置为False的行,因为它不会显示。非常感谢你的分享
Application.StatusBar = "" ' to cancel