f894009
747Messages postés
25 novembre 2007Date d'inscription
30 mai 2012Dernière intervention
15 févr. 2012 à 14:15
Bonjour,
'contrôles dans une feuille de calcul
Private Sub CommandButton1_Click()
Dim Obj As OLEObject
'boucle sur la Feuil1
For Each Obj In Sheets("Feuil1").OLEObjects
'verifie s'il s'agit d'un Label
If TypeOf Obj.Object Is MSForms.Label Then
I = CInt(Mid(Obj.Name, 6, 2))
Obj.Object.Caption = Worksheets("Data").Cells(1, I)
End If
Next Obj
End Sub
'contrôles dans UserForm
Private Sub CommandButton2_Click()
Dim Cont As Control
'Boucle sur UF
For Each Cont In Me.Controls
'verifie s'il s'agit d'un Label
If TypeOf Cont Is MSForms.Label Then
I = CInt(Mid(Cont.Name, 6, 2))
Cont.Object.Caption = Worksheets("Data").Cells(1, I)
End If
Next Cont
End Sub
'ou
'contrôles dans UserForm
Private Sub CommandButton3_Click()
For I = 1 To 30
Me("Label" & I).Caption = Worksheets("Data").Cells(1, I)
Next I
End If
Bonne suite