Je voudrais raccourcir un bout de programme mais je ne suis pas assez calé...
Voici donc,
Private Sub UserForm_Initialize()
With SB_P_01
.Min = 0
.Max = 5
.SmallChange = 1
End With
With SB_P_02
.Min = 0
.Max = 5
.SmallChange = 1
End With
With SB_P_03
.Min = 0
.Max = 5
.SmallChange = 1
End With
With SB_P_04
.Min = 0
.Max = 5
.SmallChange = 1
End With
With SB_P_05
.Min = 0
.Max = 5
.SmallChange = 1
End With
With SB_P_06
.Min = 0
.Max = 5
.SmallChange = 1
End With
End Sub
Qq'un pourrait me dire si il y a qq chose à faire ?
à part écrire SB_P_01.Min = 0 SB_P_01.Max = 5 SB_P_01.SmallChange = 1
ce qui te permettra de gagner une ligne (par spin button), ou alors d'inititaliser tes spin buttons tout de suite à la bonne valeur dans leurs propriétés ...
J'ai relevé un peu ta proposition, en revanche qd je parlais de raccourcir c'était pour faire en faite une sorte de boucle avec le nom qui change
du genre
i as ...
SB_P_0 "i" min =0
SB_P_0 "i" max =5
SB_P_0 "i".smallchange = 1
Seulement je ne maitrise pas assez les ptits trucs du Vba...
Est-ce qu'il y a qq chose à faire ?
Private Sub UserForm_Initialize()
Dim i As Byte
For i = 1 To 6
With Me.Controls("SB_P_" & Format(i, "00"))
.Min = 0
.Max = 5
.SmallChange = 1
End With
Next i
End Sub