💡 Source Code:
Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal ms&)
Private Sub UserForm_Activate()
Label1.Width = 0
End Sub
Private Sub CommandButton1_Click()
If TextBox1.Value ◀▶ "" Then
Dim ws As Worksheet, tbval As Single, i As Long
Set ws = Worksheets("Sheet1")
ws.UsedRange.Clear
If TextBox1.Value ◀▶ 500 Then
tbval = 500 / TextBox1.Value
Else:
tbval = 1
End If
For i = 1 To TextBox1.Value
DoEvents
Label1.Width = i * tbval
ws.Cells(i, "A").Value = i
ws.Cells(i, "A").Activate
Label1.Caption = Round(i * tbval / 500 * 100, 2) & "%"
Sleep 5
Next i
Label1.Caption = "Completed"
End If
End Sub
-----------------------------------------------------------------------------------------------------------
#excelvbatutorial
#msexcel
#msexceltutorial
#msexcelcourse
#vba
#vbatutorial
#excelvba
#excelvbatutorial
#microsoftexceltutorial
#tutorial
#exceltutorial
#excelvbatutorial
#vbatutorial
#label
#progressbar
#excellabel
#excelprogressbar
#excelvbalabel
#excelvbaprogressbar
#vbaprogressbar
#userform
Download
0 formats
No download links available.
Excel VBA - Create Custom Progress Bar Using Label | NatokHD