bonjour a tous ,
j'utilise ce code pour recuperer des valeurs de textbox que je cherche a optimiser et surtout a reduire en longueur
Dim shts As Object
Set shts = Sheets("tintin")
If TextBox1 <> "" Then
shts.Cells(1, 2) = TextBox1
shts.Cells(1, 1) = Label1.Caption
End If
If TextBox2 <> "" Then
shts.Cells(2, 2) = TextBox2
shts.Cells(2, 1) = Label2.Caption
End If
If TextBox3 <> "" Then
shts.Cells(3, 2) = TextBox3
shts.Cells(3, 1) = Label3.Caption
End If
If TextBox4 <> "" Then
shts.Cells(4, 2) = TextBox4
shts.Cells(4, 1) = Label4.Caption
End If
If TextBox5 <> "" Then
shts.Cells(5, 2) = TextBox5
shts.Cells(5, 1) = Label5.Caption
End If
If TextBox3 <> "" Then
shts.Cells(6, 2) = TextBox6
shts.Cells(6, 1) = Label6.Caption
End If
je me suis arreté au textbox6 mais ce code doit fonctionner sur 100 textbox et 100 label
merci a tous de votre aide et suggestion
Amicalement
Ghislain
j'utilise ce code pour recuperer des valeurs de textbox que je cherche a optimiser et surtout a reduire en longueur
Dim shts As Object
Set shts = Sheets("tintin")
If TextBox1 <> "" Then
shts.Cells(1, 2) = TextBox1
shts.Cells(1, 1) = Label1.Caption
End If
If TextBox2 <> "" Then
shts.Cells(2, 2) = TextBox2
shts.Cells(2, 1) = Label2.Caption
End If
If TextBox3 <> "" Then
shts.Cells(3, 2) = TextBox3
shts.Cells(3, 1) = Label3.Caption
End If
If TextBox4 <> "" Then
shts.Cells(4, 2) = TextBox4
shts.Cells(4, 1) = Label4.Caption
End If
If TextBox5 <> "" Then
shts.Cells(5, 2) = TextBox5
shts.Cells(5, 1) = Label5.Caption
End If
If TextBox3 <> "" Then
shts.Cells(6, 2) = TextBox6
shts.Cells(6, 1) = Label6.Caption
End If
je me suis arreté au textbox6 mais ce code doit fonctionner sur 100 textbox et 100 label
merci a tous de votre aide et suggestion
Amicalement
Ghislain