Macro a rectifier

Bonjour les amis, j'ai un classeur ou je saisi les chèques mes le problème se pose quand je passe à la saisie suivante, elle saut de 7 lignes , je veux que vous me rectifier ce qui ne va pas dans ce code :

Private Sub Bt_Valider_Click()

InsMot = Worksheets("Feuil1").Range("A65536").End(xlUp).Row + 7

Worksheets("Feuil1").Range("A" & InsMot).Value = UserForm1.TextBox1.Value

UserForm1.TextBox1.Value = ""

InsMot = Worksheets("Feuil1").Range("B65536").End(xlUp).Row + 7

Worksheets("Feuil1").Range("B" & InsMot).Value = UserForm1.TextBox2.Value

UserForm1.TextBox2.Value = ""

InsMot = Worksheets("Feuil1").Range("C65536").End(xlUp).Row + 7

Worksheets("Feuil1").Range("C" & InsMot).Value = UserForm1.TextBox3.Value

UserForm1.TextBox3.Value = ""

InsMot = Worksheets("Feuil1").Range("D65536").End(xlUp).Row + 7

Worksheets("Feuil1").Range("D" & InsMot).Value = UserForm1.TextBox4.Value

UserForm1.TextBox4.Value = ""

InsMot = Worksheets("Feuil1").Range("E65536").End(xlUp).Row + 7

Worksheets("Feuil1").Range("E" & InsMot).Value = UserForm1.TextBox5.Value

UserForm1.TextBox5.Value = ""

End Sub

voici mon fichier :

12classeur1111.xlsm (20.37 Ko)

Bonjour Maximob,

A tester voir si cela te conviens.

Cordialement.

15classeur1111.xlsm (20.64 Ko)

ça me conviendrai mieux si la saisie commence à partir de la ligne A8 car j'ai un entête qui occupe les septs premières lignes.

Bonjour,

Private Sub Bt_Valider_Click()
Dim i As Integer
    With Worksheets("Feuil1")
        InsMot = Application.Max(.Range("A65536").End(xlUp).Row + 1, 8)
        .Range("A" & InsMot).Value = Me.TextBox1.Value
        .Range("B" & InsMot).Value = Me.TextBox2.Value
        .Range("C" & InsMot).Value = Me.TextBox3.Value
        .Range("D" & InsMot).Value = Me.TextBox4.Value
        .Range("E" & InsMot).Value = Me.TextBox5.Value
        For i = 1 To 5
            Me.Controls("TextBox" & i) = ""
        Next i
    End With
End Sub

A+

je teste et je te confirme. merci d'ailleurs de ta rapidité.


merci fangy, je vais abuser un peu de ta générosité, je veux que bout de A54 la saisie passe à la deuxième page en prenant compte de l'entête qui occupe 8 lignes et commence par A64. MERCI BCP.

Rechercher des sujets similaires à "macro rectifier"