deeppurple
XLDnaute Nouveau
bonjour le forum,
j'ai un souci pour faire une boucle
dans un formulaire et avec le code ci-desous j'alimente deux feuilles excell (SORTIE1 et SORTIE2)(colonne A à S)et ça marche.
sur ce même formulaire j'ai également 260 textbox numérotés à partir de 1400
je voudrais avec une boucle que dans ma feuille (SORTIE1)
textbox1400 aille en colonneW
textbox1401 aille en colonneX
textbox1402 aille en colonneY, et ainsi de suite
j'ai essayé avec
mais ça marche pas
mon code pour rentrer mes données de la colonne A à S
Pouvez vous me donner un coup de main il faut que je termine ce soir
j'ai un souci pour faire une boucle
dans un formulaire et avec le code ci-desous j'alimente deux feuilles excell (SORTIE1 et SORTIE2)(colonne A à S)et ça marche.
sur ce même formulaire j'ai également 260 textbox numérotés à partir de 1400
je voudrais avec une boucle que dans ma feuille (SORTIE1)
textbox1400 aille en colonneW
textbox1401 aille en colonneX
textbox1402 aille en colonneY, et ainsi de suite
j'ai essayé avec
Code:
[COLOR="Red"]With sheets("SORTIE1")
dim i as integer
i=1400 to 1414
Xls.Cells(i,23)=Me.Controls("Textbox" & i)
next i
end with[/COLOR]
mon code pour rentrer mes données de la colonne A à S
Code:
Private Sub CommandButton2_Click()
Sheets("SORTIE1").Activate
Sheets("SORTIE2").Activate
Dim Xls As Worksheet, Xls1 As Worksheet, lLig As Long
Set Xls = ThisWorkbook.Worksheets("SORTIE1")
Set Xls1 = ThisWorkbook.Worksheets("SORTIE2")
'Recherche la ligne disponible
lLig = 7
While Xls.Cells(lLig, 1) <> "" And Xls1.Cells(lLig, 1) <> ""
lLig = lLig + 1
Wend
Xls.Cells(lLig, 1) = CDate(TextBox701.Value)
Xls.Cells(lLig, 2) = TextBox716.Text
Xls.Cells(lLig, 3) = TextBox715.Text
Xls.Cells(lLig, 5) = TextBox713.Text
Xls.Cells(lLig, 6) = TextBox714.Value
Xls.Cells(lLig, 7) = ComboBox153.Value
Xls.Cells(lLig, 8) = TextBox703.Value
Xls.Cells(lLig, 9) = TextBox704.Value
Xls.Cells(lLig, 10) = TextBox705.Value
Xls.Cells(lLig, 11) = TextBox706.Text
Xls.Cells(lLig, 12) = TextBox1354.Text
Xls.Cells(lLig, 13) = TextBox1353.Value
Xls.Cells(lLig, 14) = TextBox709.Value
Xls.Cells(lLig, 15) = TextBox710.Value
Xls.Cells(lLig, 16) = TextBox711.Value
Xls.Cells(lLig, 17) = TextBox712.Value
Xls1.Cells(lLig, 1) = CDate(TextBox701.Value)
Xls1.Cells(lLig, 2) = TextBox716.Text
Xls1.Cells(lLig, 3) = TextBox715.Text
Xls1.Cells(lLig, 5) = TextBox713.Text
Xls1.Cells(lLig, 6) = TextBox714.Value
Xls1.Cells(lLig, 7) = ComboBox153.Value
Xls1.Cells(lLig, 8) = TextBox703.Value
Xls1.Cells(lLig, 9) = TextBox704.Value
Xls1.Cells(lLig, 10) = TextBox705.Value
Xls1.Cells(lLig, 11) = TextBox706.Text
Xls1.Cells(lLig, 12) = TextBox1354.Text
Xls1.Cells(lLig, 13) = TextBox1353.Value
Xls1.Cells(lLig, 14) = TextBox709.Value
Xls1.Cells(lLig, 15) = TextBox710.Value
Xls1.Cells(lLig, 16) = TextBox711.Value
Xls1.Cells(lLig, 17) = TextBox712.Value
End With
End Sub
Pouvez vous me donner un coup de main il faut que je termine ce soir