elle agit uniquement en fonction d'une boucle ?Oui en effet.
Sub exemple() UserForm1.ProgressBar1.Max = 100 UserForm1.Show nbToGo = 25 For i = 1 To nbToGo ValP = Int((i / nbToGo) * 100) UserForm1.ProgressBar1.Value = ValP Next End Sub
Private Sub Cmd_PDF_Click()
Dim i As Byte
'boucle sur les éléments de la ListBox
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
feuil = ListBox1.List(i) 'nom de la feuille
Sheets(feuil).Select
ToPdf
End If
Next i
End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub Cmd_PDF_Click()
Dim i As Byte
Dim j As Integer
'boucle sur les éléments de la ListBox
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
feuil = ListBox1.List(i) 'nom de la feuille
Sheets(feuil).Select
ToPdf
End If
ProgressBar.ProgressBar1.Max = 100
ProgressBar.Show
nbToGo = 25
For j = 1 To nbToGo
ValP = Int((j / nbToGo) * 100)
ProgressBar.ProgressBar1.Value = ValP
Next j
Next i
End Sub
Private Sub Cmd_PDF_Click() Dim i As Byte Dim j As Integer DIm nbToGo as integer nbToGo = ListBox1.ListCount - 1 ProgressBar.ProgressBar1.Max = 100 ProgressBar.Show 'boucle sur les éléments de la ListBox For i = 0 To ListBox1.ListCount - 1 If ListBox1.Selected(i) = True Then feuil = ListBox1.List(i) 'nom de la feuille Sheets(feuil).Select ' Maj ProgressBar ValP = Int((i / nbToGo) * 100) ProgressBar.ProgressBar1.Value = ValP ToPdf End If Next End Sub