Excel VBA进度/状态栏

时间:2017-10-07 09:52:22

标签: excel vba

今天我尝试学习vba进度条/状态栏,我把下面的代码放在vba代码中,想要在调用两个宏时显示状态栏,但是我没有工作,没有错误,msgbox'完成'出现了,两个应该运行的宏也没有执行;有谁知道代码出了什么问题?谢谢。

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

1 个答案:

答案 0 :(得分:0)

False中的Application.StatusBar = False错误:您应该提供字符串,例如

Application.StatusBar = "False" ' to display "False"

Application.StatusBar = "" ' to cancel