2017-10-07 165 views
-1

今天我試着學習vba進度條/狀態欄,我把下面的代碼放在vba代碼中,想調用兩個宏時顯示狀態欄,但是我不工作,沒有錯誤,msgbox 'done'出現了,應該運行的兩個宏也沒有執行;任何人都知道代碼出了什麼問題?謝謝。Excel VBA進度/狀態欄

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 
+0

將有助於瞭解目前的結果是什麼?你是否收到任何錯誤訊息?考慮編輯你的問題使用這裏的指導:https://stackoverflow.com/help/how-to-ask – QHarr

+0

我運行宏msgbox'完成'出現後。到底是怎麼回事? – robin

+0

tq對於我的指導,我修改了我的問題。 – robin

回答

0

Application.StatusBar = FalseFalse是錯誤的:你應該提供的字符串,例如

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

Application.StatusBar = "" ' to cancel 

+0

非常感謝你的分享 – robin