Sub Remplissage()
Dim delai#, txt$, i%, t#
delai = 2 / 86400 '2 secondes, à adapter
txt = "OOOOOOOXOOOXXOOOOOOOOOXOOOXXOOO"
With [C2]
.Resize(, 31) = "" 'RAZ
For i = 1 To 31
.Offset(, i - 1) = Mid(txt, i, 1)
t = Now + delai
While Now < t: Wend
Next
End With
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [C2].Resize(, 31)) Is Nothing Then Exit Sub
Dim i%, c As Range
With Progress_bar
.Show 0 'non modal
For i = 1 To 31
Set c = [C2].Offset(, i - 1)
If c <> "" Then .Controls("Label" & i) = c(0)
.Controls("Label" & i).BackColor = IIf(c = "O", &HFF00&, IIf(c = "X", &HFFFF&, &H8000000E))
Next
.Controls("Label32") = "Progression " & IIf(c = "", "en cours...", "terminée !")
DoEvents
ActiveCell.Activate
End With
End Sub