Option Explicit
Sub StartProcessing1()
' displays a progress bar while a macro runs, requires a reference to MSCOMCTRL.OCX
Dim lngTotal As Long, lngI As Long
Dim Cel As Range
Dim Lg As Integer
Dim Donnees As Variant
' initiate progressbar
Load frmProgressBar1
With frmProgressBar1
.ProgressBar1.Scrolling = ccScrollingSmooth ' or ccScrollingSmooth
.Show ' set the UserForms ShowModal property to false before running
' or .Show False
End With
UpdateProgressBar1 0, "Processing..." ' set initial progress status
' start the process
lngTotal = 200
For lngI = 1 To lngTotal
If lngI Mod 10 = 0 Then ' update the progressbar for every 50th loop
UpdateProgressBar1 lngI / lngTotal * 100, "Processing " & Format(lngI / lngTotal, "0%") & "..."
End If
' do something, place your code here
'Range("C2").Formula = Format(Time, "hh:mm:ss")
'Application.Run "drawing_split"
Sheet3.Range("AQ4:AR65489").ClearContents
Lg = 4
For Each Cel In Sheet3.Range("H4:H" & [H65489].End(xlUp).Row)
If Cel.Value <> "" And Not Cel.Find("/") Is Nothing Then
Donnees = Split(Sheet3.Range("H" & Cel.Row), "/")
If Len(Sheet3.Range("H" & Lg).Value) < 17 Then
Sheet3.Range("AR" & Lg).Value = Left(Donnees(0), 5) & Right(Donnees(1), 3)
Else
Sheet3.Range("AQ" & Lg).Value = Donnees(0)
Sheet3.Range("AR" & Lg).Value = Donnees(1)
End If
Lg = Lg + 1
End If
Next
Next lngI
'Range("C2").ClearContents
' clean up
frmProgressBar1.Hide
Unload frmProgressBar1
End Sub
Private Sub UpdateProgressBar1(NewValue As Single, Optional NewCaption As String)
' updates the progressbar dialog
With frmProgressBar1
If Not IsMissing(NewCaption) Then .Caption = NewCaption
.ProgressBar1.Value = NewValue
If NewValue = 0 Then .Repaint
End With
End Sub