Modifier le Caption des boutons à la volée

cs_Baboune1 Messages postés 13 Date d'inscription lundi 31 décembre 2001 Statut Membre Dernière intervention 28 mars 2002 - 17 mars 2002 à 21:11
Didiboy Messages postés 22 Date d'inscription vendredi 13 octobre 2000 Statut Membre Dernière intervention 26 octobre 2002 - 25 mars 2002 à 19:34
Boujour,
Comment peut on simplifier ceci en VBA Excel :

FormCalendrier.Bouton1.Caption = Calendar(1, 1)
FormCalendrier.Bouton2.Caption = Calendar(1, 2)
FormCalendrier.Bouton3.Caption = Calendar(1, 3)
FormCalendrier.Bouton4.Caption = Calendar(1, 4)
FormCalendrier.Bouton5.Caption = Calendar(1, 5)
FormCalendrier.Bouton6.Caption = Calendar(1, 6)
FormCalendrier.Bouton7.Caption = Calendar(1, 7)
FormCalendrier.Bouton8.Caption = Calendar(2, 1)
FormCalendrier.Bouton9.Caption = Calendar(2, 2)
FormCalendrier.Bouton10.Caption = Calendar(2, 3)
FormCalendrier.Bouton11.Caption = Calendar(2, 4)
FormCalendrier.Bouton12.Caption = Calendar(2, 5)
FormCalendrier.Bouton13.Caption = Calendar(2, 6)
FormCalendrier.Bouton14.Caption = Calendar(2, 7)

FormCalendrier.Bouton X.Caption= Calendar(Y, Z)
ne fonctionne pas !
Merci de votre aide.

1 réponse

Didiboy Messages postés 22 Date d'inscription vendredi 13 octobre 2000 Statut Membre Dernière intervention 26 octobre 2002
25 mars 2002 à 19:34
il faut moins de lignes !
deja il faut ke ton tableau soit de type string
ensuite, pour tes boutons,fait des groupe !
(il auront un index)
ca devrait ressembler à ca :
dim i,j,k as integer
k=0
for j=1 to 2
For i=1 to 7
k=k+1
FormCalendrier.Bouton(k).Caption = Calendar(j, i)
next i
next j
0
Rejoignez-nous