Seems like when I do this, I lose the variables such as .BarColor.Tag = .BarBorder.width / Maxvalue etc.
It seems to be working for in the example (linked below) I copied it from but when I applied it to my program which has different module for initiate progressBar and show progressBar.
These variable doesn't carry over. Please advise.
https://www.myonlinetraininghub.com/excel-progress-bar-for-vba
Sub InitProgressBar(MaxValue As Long)
With ProgressBar
.BarColor.Tag = .BarBorder.Width / MaxValue
.BarColor.Width = 0
.ProgressText = ""
.Show vbModeless
End With
End Sub
Sub ShowProgress(Progress As Long)
With ProgressBar
'Round Up
.BarColor.Width = Round(.BarColor.Tag * Progress, 0)
.ProgressText.Caption = Round((.BarColor.Width / .BarBorder.Width * 100), 0) & "% complete"
End With
End Sub
It seems to be working for in the example (linked below) I copied it from but when I applied it to my program which has different module for initiate progressBar and show progressBar.
These variable doesn't carry over. Please advise.
https://www.myonlinetraininghub.com/excel-progress-bar-for-vba
Sub InitProgressBar(MaxValue As Long)
With ProgressBar
.BarColor.Tag = .BarBorder.Width / MaxValue
.BarColor.Width = 0
.ProgressText = ""
.Show vbModeless
End With
End Sub
Sub ShowProgress(Progress As Long)
With ProgressBar
'Round Up
.BarColor.Width = Round(.BarColor.Tag * Progress, 0)
.ProgressText.Caption = Round((.BarColor.Width / .BarBorder.Width * 100), 0) & "% complete"
End With
End Sub