Created
August 19, 2019 12:53
-
-
Save DataSolveProblems/ddbbe8f47549f1726643b02b57f61304 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Private Sub ProgressBar_Run() | |
Dim wsData As Worksheet, RowMax As Long, ColumnMax As Long | |
Dim Counter As Long, RowNumber As Long, ColumnNumber As Long | |
Dim PercentText As String | |
Set wsData = ThisWorkbook.Worksheets("Data") | |
With wsData | |
.Cells.Clear | |
Application.ScreenUpdating = False | |
Counter = 1 | |
RowMax = 1000 | |
ColumnMax = 20 | |
For RowNumber = 1 To RowMax | |
For ColumnNumber = 1 To ColumnMax | |
.Cells(RowNumber, ColumnNumber).Value = Int(Rnd * 1000) | |
Counter = Counter + 1 | |
Next ColumnNumber | |
PercentText = Counter / (RowMax * ColumnMax) | |
With frmProgress | |
.FrameProgress.Caption = Format(PercentText, "0%") | |
.LabelProgress.Width = PercentText * (.FrameProgress.Width - 10) | |
End With | |
DoEvents | |
Next RowNumber | |
Application.ScreenUpdating = True | |
End With | |
Set wsData = Nothing | |
Unload frmProgress | |
End Sub | |
Private Sub UserForm_Activate() | |
Call ProgressBar_Run | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment