|
|
|
Recalculate Macro and Progress Bar
0
This macro is recalculating selected cells with showing the progress bar in bottom status bar.
Progress bar example :
しばらくお待ちください。再計算しています。| ***_______ | 35% | 35/100 |
Progress bar example :
しばらくお待ちください。再計算しています。| ***_______ | 35% | 35/100 |
Sub 選択部分再計算()
Dim Total As Integer
Dim Counter As Integer
Total = Selection.Cells.Count
Counter = 1
For Each SelectedCell In Selection
SelectedCell.Calculate
Counter = Counter + 1
Application.StatusBar = "しばらくお待ちください。再計算しています。 " & ProgressView(Counter, Total)
Next
Application.StatusBar = False
MsgBox ("再計算が完了しました。")
End Sub
Function ProgressView(Now As Integer, Total As Integer)
Dim Per As Integer
Dim Msg As String
Dim Bar As String
Per = Int(Now / Total * 100)
Select Case Per
Case Is >= 90
Bar = "**********"
Case Is >= 80
Bar = "*********_"
Case Is >= 70
Bar = "********__"
Case Is >= 60
Bar = "*******___"
Case Is >= 50
Bar = "******____"
Case Is >= 40
Bar = "*****_____"
Case Is >= 30
Bar = "***_______"
Case Is >= 20
Bar = "**________"
Case Is >= 10
Bar = "*_________"
Case Else
Bar = "__________"
End Select
Msg = " | " & Bar & " | " & Per & "% | " & Now & " in " & Total & " | "
ProgressView = Msg
End Function




There are currently no comments for this snippet.