i have created a macro and i am trying to add a progress bar to it. The only thing i've done so far is to create a UserForm where i have 4 Labels: White line label = Label1; Green line label: Label2; In progress label: Label3; the label under in progress: Label4. And here is an image:
And my code has the following function: I take the values from the Range M:O, insert them in B4, B7 and B9 and for every single entry for B4, B7 and B9 i create a PDF document. Example: 100 entries for B4, B7 and B9 = 100 Pdf Documents. I want to create a progress bar which displays the whole progress. Any ideas how? The only thing i managed to create is to display a message in the status bar and to make the cursor still..
Code:
Sub SavePDF4()
Const sPath = "C:\Users\TestMacro\"
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim r As Long
Dim m As Long
Application.ScreenUpdating = False
Set ws1 = ThisWorkbook.Worksheets("Protocol")
Set ws2 = ThisWorkbook.Worksheets("Input")
m = ws2.Range("M:O").Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Application.Cursor = xlWait
Application.DisplayStatusBar = True
Application.StatusBar = "Please Wait.."
For r = 1 To m
ws2.Range("J5").Value = Range("J5").Value + 1
ws1.Range("B4").Value = ws2.Range("M" & r).Value
ws1.Range("B7").Value = ws2.Range("N" & r).Value
ws1.Range("B9").Value = ws2.Range("O" & r).Value
ws1.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=sPath & "Report_" & ws2.Range("J5").Value & ".pdf"
Next r
Application.Cursor = xlDefault
Application.StatusBar = False
Application.ScreenUpdating = True
End Sub