有没有办法在Excel VBA中创建一个Process Bar 作为调用多个sub?每个子程序大约需要10分钟才能从文件复制并粘贴到此工作簿。我想知道它处理了多长时间(已完成百分比)。 我知道如果我有一个for循环进度,我可以为它应用进度条。不知道如何循环这样的事情。
Sub batch_import()
Call Import_NJ
Call Import_NY
Call Import_MD
Call Import_VA
Call Import_WV
Call Import_PA
Call Import_KY
Call Import_TN
Call Import_IN
Call Import_IA
Call Import_MI
Call Import_MO
Call Import_IL
Call Import_LW
End Sub
答案 0 :(得分:0)
如果您总是要调用相同数量的潜艇(即确定的14个)。你可以做到
Sub batch_import()
with Application
Call Import_NJ
.StatusBar = "Progress: " & Format(1 / 14, "0%")
Call Import_NY
.StatusBar = "Progress: " & Format(2 / 14, "0%")
Call Import_MD
.StatusBar = "Progress: " & Format(3 / 14, "0%")
Call Import_VA
.StatusBar = "Progress: " & Format(4 / 14, "0%")
Call Import_WV
.StatusBar = "Progress: " & Format(5 / 14, "0%")
Call Import_PA
.StatusBar = "Progress: " & Format(6 / 14, "0%")
Call Import_KY
.StatusBar = "Progress: " & Format(7 / 14, "0%")
Call Import_TN
.StatusBar = "Progress: " & Format(8 / 14, "0%")
Call Import_IN
.StatusBar = "Progress: " & Format(9 / 14, "0%")
Call Import_IA
.StatusBar = "Progress: " & Format(10 / 14, "0%")
Call Import_MI
.StatusBar = "Progress: " & Format(11 / 14, "0%")
Call Import_MO
.StatusBar = "Progress: " & Format(12 / 14, "0%")
Call Import_IL
.StatusBar = "Progress: " & Format(13 / 14, "0%")
Call Import_LW
.StatusBar = "Progress: " & Format(14 / 14, "0%")
.StatusBar =null
end with
End Sub