Back to Browse

Excel VBA - Create Custom Progress Bar Using Label (Very Interesting Technique)

482 views
Jul 11, 2022
9:30

💡 Source Code: Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal ms&) Dim n As Byte Private Sub UserForm_Activate() prog_bar1.Width = 0 With Me .Left = Application.Left .Height = Application.Height .Top = Application.Top .Width = Application.Width End With End Sub Private Sub CommandButton1_Click() Dim pbw As Integer, cnt As Integer, pb_cnt As Integer n = n + 1 pbw = prog_bar1.Width cnt = 28.5 * n prog_bar1.Caption = Round(n / 20 * 100, 2) & "%" For pb_cnt = 0 To cnt If pb_cnt ◀ pbw Then prog_bar1.Width = pb_cnt Else: DoEvents prog_bar1.Width = pb_cnt Sleep 10 End If Next pb_cnt curval.Caption = "CurrentValue:=" & n If n = 20 Then n = 0 prog_bar1.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 #commandbutton #vbacommandbutton #excelcommandbutton #veryinterestingtechnique

Download

0 formats

No download links available.

Excel VBA - Create Custom Progress Bar Using Label (Very Interesting Technique) | NatokHD