Pouvoir sélectionné un label et le modifier

Fermé
nadeare Messages postés 5 Date d'inscription mardi 14 avril 2009 Statut Membre Dernière intervention 13 juillet 2009 - 16 avril 2009 à 19:25
Bonjour,

Dim d As Integer ' Compteur destiné à individualiser les clés.
Dim a As Long
Dim reponse As Long
Dim b As Long
Dim Mylabel As Control
Private Sub UserForm_Activate()
UserForm1.Height = Application.Height
UserForm1.Width = Application.Width
End Sub
Private Sub TextBox0_Change()
a = 1: b = 1: Cells(a, b) = UCase(TextBox0): TextBox1.Visible = False: TextBox1.Value = ""
If Len(TextBox0) = 4 Then
If TextBox1.Top <> TextBox0.Top Then TextBox1.Top = TextBox0.Top: TextBox1.Left = TextBox0.Left + 80
TextBox1.Visible = True
TextBox1_Change
End If
End Sub
Private Sub TextBox1_Change()
a = 1: b = 2: Cells(a, b) = UCase(TextBox1): Cells(a, b - 1) = TextBox0
If Len(TextBox1) = 4 Then lb
End Sub
Sub lb()
Set Label = Controls.Add("forms.label.1", "label" & a, Visible = True) ' creation automatique du label nommé nom de label
Label.Left = 157 ' label à afficher 200 pixels à gauche
Label.BackColor = &HFFFFFF: Label.ForeColor = &H80000007: Label.Caption = UCase(Cells(a, b)): Label.Top = TextBox1.Top
Label.Left = TextBox1.Left: Label.TextAlign = fmTextAlignCenter
If Len(TextBox1) = 4 Then Selection.EntireRow.Insert: TextBox1 = "": TextBox1.Top = TextBox1.Top + 20
If TextBox1.Top = 540 Then TextBox1.Top = 140: TextBox1.Left = TextBox1.Left + 77
End Sub
Sub label1_click()
TextBox1.Visible = True
Label1.Text = TextBox1.Text
End Sub

Avec ce programe je crée des label uax besoin , supposon que j'ai trois label de crées et j'aimerais que lorsque je click sur un label que mon textbox1 prenne ca place pour pouvoir modifier le label.

un bon conseille serait apprécié
merci
A voir également: