Incrémentation de lignes via formulaire sans écraser les données déjà remplies

NicoMay

XLDnaute Nouveau
Bonjour à tous,

Sur le fichier joint, je cherche à compléter des informations commerciales à partir du remplissage d'un formulaire dans l'onglet accueil.

Une fois que le commercial a complété les informations, il valide et les données vont s'incrémenter sur l'onglet Comptes-rendus.

Tout fonctionne jusque là, sauf que je souhaiterais que chaque nouveau rapport vienne s'incrémenter sous la dernière ligne complétée dans l'onglet Comptes-rendus. Or pour le moment, à chaque fois que je valide, les nouvelles données viennent écraser les données de la ligne N°2. Je pensais avoir trouvé une formule qui fonctionne mais ça ne semble pas être le cas.

Pourriez-vous m'aider.

Merci d'avance.
 

Pièces jointes

  • Rapport_Commercial.xlsm
    118.2 KB · Affichages: 31

st007

XLDnaute Barbatruc
Re : Incrémentation de lignes via formulaire sans écraser les données déjà remplies

Bonsoir,

Ton formulaire ne s'ouvrant pas chez moi sous 2007,

une piste :
'Détermination de la prochaine ligne
LigneSuivante = Application.WorksheetFunction.CountA(Range("A:A")) + 1
'Transfert du numéro d'inventaire
Cells(LigneSuivante, 1) = TextBoxDossier.Text
 

NicoMay

XLDnaute Nouveau
Re : Incrémentation de lignes via formulaire sans écraser les données déjà remplies

Merci pour la réponse mais j'avoue que c'est un peu du Chinois. Voilà le rapport tel qu'écrit actuellement (en rouge la partie renvoi à la ligne):



Private Sub CommandButton1_Click()
Application.ScreenUpdating = False


Dim derligne
Dim pos
Sheets("Comptes-rendus").Select
derligne = Sheets(1).Range("A65000").End(xlUp).Row + 1

If ComboBox2.Value = "" Then
Label30.Visible = True
Exit Sub
End If

Range("A" & derligne).Value = ComboBox2.Value
Range("c" & derligne).Value = ComboBox3.Value
Range("d" & derligne).Value = CheckBox1.Value
Range("e" & derligne).Value = ComboBox1.Value
Range("f" & derligne).Value = TextBox2.Value
Range("g" & derligne).Value = ComboBox4.Value
Range("h" & derligne).Value = TextBox1.Value
Range("i" & derligne).Value = ComboBox5.Value
Range("j" & derligne).Value = ComboBox6.Value
Range("k" & derligne).Value = CheckBox2.Value
Range("l" & derligne).Value = TextBox14.Value
Range("m" & derligne).Value = ComboBox10.Value
Range("n" & derligne).Value = ComboBox7.Value
Range("o" & derligne).Value = CheckBox3.Value
Range("p" & derligne).Value = TextBox15.Value
Range("q" & derligne).Value = ComboBox11.Value
Range("r" & derligne).Value = ComboBox8.Value
Range("s" & derligne).Value = ComboBox9.Value
Range("t" & derligne).Value = DTPicker2.Value
Range("u" & derligne).Value = TextBox13.Value
Range("b" & derligne).Value = DTPicker1.Value

TextBox1.Value = ""
TextBox2.Value = ""
TextBox14.Value = ""
TextBox15.Value = ""
DTPicker1.Value = ""
DTPicker2.Value = ""
ComboBox2.Value = ""
ComboBox3.Value = ""
CheckBox1.Value = ""
CheckBox2.Value = ""
ComboBox1.Value = ""
ComboBox4.Value = ""
ComboBox5.Value = ""
ComboBox6.Value = ""
ComboBox10.Value = ""
ComboBox7.Value = ""
CheckBox3.Value = ""
ComboBox11.Value = ""
ComboBox8.Value = ""
ComboBox9.Value = ""
TextBox13.Value = ""
Label30.Visible = False


Application.ScreenUpdating = True
End Sub

Private Sub CommandButton2_Click()
Rapport.Hide
End Sub
 

st007

XLDnaute Barbatruc
Re : Incrémentation de lignes via formulaire sans écraser les données déjà remplies

derligne = Sheets("Comptes-rendus").Range("A65000").End(xlUp).Row + 1

si je ne m'abuse, ton sheets (1) concerne la feuille nommée Acceuil

la compte rendu serait au moins (3)
 

Discussions similaires

Réponses
10
Affichages
676

Statistiques des forums

Discussions
311 725
Messages
2 081 947
Membres
101 849
dernier inscrit
florentMIG