Bonjour
je cherche à simplifier un code concernant un transfert de textbox vers une feuille.
Private Sub B_transfert_Click()
Dim DerLig As Integer
With Sheets("Sortie")
DerLig = .Range("A" & Rows.Count).End(xlUp).Row + 1
.Range("A" & DerLig) = T1
.Range("B" & DerLig) = T2
.Range("C" & DerLig) = T3
.Range("D" & DerLig) = TQS1
.Range("E" & DerLig) = TNST1
.Range("F" & DerLig) = T_date
.Range("G" & DerLig) = T_dem
.Range("H" & DerLig) = T_aff
DerLig = .Range("A" & Rows.Count).End(xlUp).Row + 1
.Range("A" & DerLig) = T4
.Range("B" & DerLig) = T5
.Range("C" & DerLig) = T6
.Range("D" & DerLig) = TQS4
.Range("E" & DerLig) = TNST4
.Range("F" & DerLig) = T_date
.Range("G" & DerLig) = T_dem
.Range("H" & DerLig) = T_aff
DerLig = .Range("A" & Rows.Count).End(xlUp).Row + 1
.Range("A" & DerLig) = T7
.Range("B" & DerLig) = T8
.Range("C" & DerLig) = T9
.Range("D" & DerLig) = TQS7
.Range("E" & DerLig) = TNST7
.Range("F" & DerLig) = T_date
.Range("G" & DerLig) = T_dem
.Range("H" & DerLig) = T_aff
DerLig = .Range("A" & Rows.Count).End(xlUp).Row + 1
.Range("A" & DerLig) = T10
.Range("B" & DerLig) = T11
.Range("C" & DerLig) = T12
.Range("D" & DerLig) = TQS10
.Range("E" & DerLig) = TNST10
.Range("F" & DerLig) = T_date
.Range("G" & DerLig) = T_dem
.Range("H" & DerLig) = T_aff
DerLig = .Range("A" & Rows.Count).End(xlUp).Row + 1
End With
Unload Me
End Sub
Idem pour le changement de focus
Private Sub T1_Change()
Me.TQS1.SetFocus
End Sub
Private Sub T4_Change()
Me.TQS4.SetFocus
End Sub
Private Sub T7_Change()
Me.TQS7.SetFocus
End Sub
Private Sub T10_Change()
Me.TQS10.SetFocus
End Sub
Private Sub T13_Change()
Me.TQS13.SetFocus
End Sub
Par avance merci
Vmax67
Private Sub T1_Change()
Me.TQS1.SetFocus
End Sub
Private Sub T4_Change()
Me.TQS4.SetFocus
End Sub
Private Sub T7_Change()
Me.TQS7.SetFocus
End Sub
Private Sub T10_Change()
Me.TQS10.SetFocus
End Sub
Private Sub T13_Change()
Me.TQS13.SetFocus
End Sub
je cherche à simplifier un code concernant un transfert de textbox vers une feuille.
Private Sub B_transfert_Click()
Dim DerLig As Integer
With Sheets("Sortie")
DerLig = .Range("A" & Rows.Count).End(xlUp).Row + 1
.Range("A" & DerLig) = T1
.Range("B" & DerLig) = T2
.Range("C" & DerLig) = T3
.Range("D" & DerLig) = TQS1
.Range("E" & DerLig) = TNST1
.Range("F" & DerLig) = T_date
.Range("G" & DerLig) = T_dem
.Range("H" & DerLig) = T_aff
DerLig = .Range("A" & Rows.Count).End(xlUp).Row + 1
.Range("A" & DerLig) = T4
.Range("B" & DerLig) = T5
.Range("C" & DerLig) = T6
.Range("D" & DerLig) = TQS4
.Range("E" & DerLig) = TNST4
.Range("F" & DerLig) = T_date
.Range("G" & DerLig) = T_dem
.Range("H" & DerLig) = T_aff
DerLig = .Range("A" & Rows.Count).End(xlUp).Row + 1
.Range("A" & DerLig) = T7
.Range("B" & DerLig) = T8
.Range("C" & DerLig) = T9
.Range("D" & DerLig) = TQS7
.Range("E" & DerLig) = TNST7
.Range("F" & DerLig) = T_date
.Range("G" & DerLig) = T_dem
.Range("H" & DerLig) = T_aff
DerLig = .Range("A" & Rows.Count).End(xlUp).Row + 1
.Range("A" & DerLig) = T10
.Range("B" & DerLig) = T11
.Range("C" & DerLig) = T12
.Range("D" & DerLig) = TQS10
.Range("E" & DerLig) = TNST10
.Range("F" & DerLig) = T_date
.Range("G" & DerLig) = T_dem
.Range("H" & DerLig) = T_aff
DerLig = .Range("A" & Rows.Count).End(xlUp).Row + 1
End With
Unload Me
End Sub
Idem pour le changement de focus
Private Sub T1_Change()
Me.TQS1.SetFocus
End Sub
Private Sub T4_Change()
Me.TQS4.SetFocus
End Sub
Private Sub T7_Change()
Me.TQS7.SetFocus
End Sub
Private Sub T10_Change()
Me.TQS10.SetFocus
End Sub
Private Sub T13_Change()
Me.TQS13.SetFocus
End Sub
Par avance merci
Vmax67
Private Sub T1_Change()
Me.TQS1.SetFocus
End Sub
Private Sub T4_Change()
Me.TQS4.SetFocus
End Sub
Private Sub T7_Change()
Me.TQS7.SetFocus
End Sub
Private Sub T10_Change()
Me.TQS10.SetFocus
End Sub
Private Sub T13_Change()
Me.TQS13.SetFocus
End Sub