Bonjour à tous,
j'aimerai savoir comment additionner plusieurs cellules d'une même ligne dans un userform ?
Voici un code que j'ai créé.
Function copy_from_form()
Dim LastRow As Long
LastRow = ActiveWorkbook.Sheets("Générale").Range("A1000000").End(xlUp).Row
LastRow = LastRow + 1
With ActiveWorkbook.Sheets("Générale")
.Range("A" & LastRow).Value = TextBox1.Value
.Range("B" & LastRow).Value = TextBox2.Value
.Range("C" & LastRow).Value = TextBox3.Value
.Range("D" & LastRow).Value = TextBox4.Value
.Range("E" & LastRow).Value = TextBox5.Value
.Range("F" & LastRow).Value = TextBox6.Value
.Range("G" & LastRow).Value = TextBox8.Value
.Range("H" & LastRow).Value = TextBox9.Value
.Range("I" & LastRow).Value = TextBox18.Value
.Range("J" & LastRow).Value = TextBox7.Value
.Range("K" & LastRow).Value = TextBox11.Value
.Range("L" & LastRow).Value = TextBox12.Value
.Range("M" & LastRow).Value = TextBox13.Value
.Range("N" & LastRow).Value = TextBox17.Value
.Range("O" & LastRow).Value = TextBox19.Value
.Range("P" & LastRow).Value = TextBox20.Value
.Range("Q" & LastRow).Value = TextBox21.Value
.Range("R" & LastRow).Value = TextBox22.Value
.Range("S" & LastRow).Value = TextBox23.Value
.Range("T" & LastRow).Value = TextBox24.Value
.Range("U" & LastRow).Value = TextBox25.Value
.Range("V" & LastRow).Value = TextBox26.Value
.Range("W" & LastRow).Value = TextBox27.Value
.Range("X" & LastRow).Value = TextBox28.Value
.Range("Y" & LastRow).Value = TextBox29.Value
.Range("Z" & LastRow).Value = TextBox30.Value
.Range("AA" & LastRow).Value = TextBox31.Value
.Range("AB" & LastRow).Value = TextBox32.Value
.Range("AC" & LastRow).Value = TextBox33.Value
.Range("AD" & LastRow).Value = TextBox34.Value
.Range("AE" & LastRow).Value = TextBox35.Value
.Range("AF" & LastRow).Value = TextBox36.Value
.Range("AG" & LastRow).Value = TextBox37.Value
.Range("AH" & LastRow).Value = TextBox38.Value
.Range("AI" & LastRow).Value = TextBox39.Value
.Range("AJ" & LastRow).Value = TextBox40.Value
.Range("AK" & LastRow).Value = TextBox41.Value
.Range("AL" & LastRow).Value = TextBox42.Value
.Range("AM" & LastRow).Value = TextBox43.Value
.Range("AN" & LastRow).Value = TextBox44.Value
.Range("AO" & LastRow).Value = TextBox45.Value
.Range("AP" & LastRow).Value = TextBox46.Value
.Range("AQ" & LastRow).Value = TextBox47.Value
.Range("AR" & LastRow).Value = TextBox48.Value
.Range("AS" & LastRow).Value = TextBox49.Value
.Range("AT" & LastRow).Value = TextBox51.Value
End With
End Function
A celui la j'aimerai que ..Range("AT" & LastRow).Value = TextBox51.Value me donne la somme des cellules Q,S,U,W,Y,AA,AC,AE,AG,AI,AK,AM,AO,AQ,AS
Auriez vous une idée ?
Merci d'avance
j'aimerai savoir comment additionner plusieurs cellules d'une même ligne dans un userform ?
Voici un code que j'ai créé.
Function copy_from_form()
Dim LastRow As Long
LastRow = ActiveWorkbook.Sheets("Générale").Range("A1000000").End(xlUp).Row
LastRow = LastRow + 1
With ActiveWorkbook.Sheets("Générale")
.Range("A" & LastRow).Value = TextBox1.Value
.Range("B" & LastRow).Value = TextBox2.Value
.Range("C" & LastRow).Value = TextBox3.Value
.Range("D" & LastRow).Value = TextBox4.Value
.Range("E" & LastRow).Value = TextBox5.Value
.Range("F" & LastRow).Value = TextBox6.Value
.Range("G" & LastRow).Value = TextBox8.Value
.Range("H" & LastRow).Value = TextBox9.Value
.Range("I" & LastRow).Value = TextBox18.Value
.Range("J" & LastRow).Value = TextBox7.Value
.Range("K" & LastRow).Value = TextBox11.Value
.Range("L" & LastRow).Value = TextBox12.Value
.Range("M" & LastRow).Value = TextBox13.Value
.Range("N" & LastRow).Value = TextBox17.Value
.Range("O" & LastRow).Value = TextBox19.Value
.Range("P" & LastRow).Value = TextBox20.Value
.Range("Q" & LastRow).Value = TextBox21.Value
.Range("R" & LastRow).Value = TextBox22.Value
.Range("S" & LastRow).Value = TextBox23.Value
.Range("T" & LastRow).Value = TextBox24.Value
.Range("U" & LastRow).Value = TextBox25.Value
.Range("V" & LastRow).Value = TextBox26.Value
.Range("W" & LastRow).Value = TextBox27.Value
.Range("X" & LastRow).Value = TextBox28.Value
.Range("Y" & LastRow).Value = TextBox29.Value
.Range("Z" & LastRow).Value = TextBox30.Value
.Range("AA" & LastRow).Value = TextBox31.Value
.Range("AB" & LastRow).Value = TextBox32.Value
.Range("AC" & LastRow).Value = TextBox33.Value
.Range("AD" & LastRow).Value = TextBox34.Value
.Range("AE" & LastRow).Value = TextBox35.Value
.Range("AF" & LastRow).Value = TextBox36.Value
.Range("AG" & LastRow).Value = TextBox37.Value
.Range("AH" & LastRow).Value = TextBox38.Value
.Range("AI" & LastRow).Value = TextBox39.Value
.Range("AJ" & LastRow).Value = TextBox40.Value
.Range("AK" & LastRow).Value = TextBox41.Value
.Range("AL" & LastRow).Value = TextBox42.Value
.Range("AM" & LastRow).Value = TextBox43.Value
.Range("AN" & LastRow).Value = TextBox44.Value
.Range("AO" & LastRow).Value = TextBox45.Value
.Range("AP" & LastRow).Value = TextBox46.Value
.Range("AQ" & LastRow).Value = TextBox47.Value
.Range("AR" & LastRow).Value = TextBox48.Value
.Range("AS" & LastRow).Value = TextBox49.Value
.Range("AT" & LastRow).Value = TextBox51.Value
End With
End Function
A celui la j'aimerai que ..Range("AT" & LastRow).Value = TextBox51.Value me donne la somme des cellules Q,S,U,W,Y,AA,AC,AE,AG,AI,AK,AM,AO,AQ,AS
Auriez vous une idée ?
Merci d'avance