Here’s my problem, I’ve a table in sheet named « Formulaire du journal », in this sheet the user enter the informations and fill the table (screenshot 1), the informations of this table is trensfered to another sheet called « Journal » (screenshot 2)
The table should be transferred (screenshot 6)
I followed a video on youtube so I tried a VBA code but i’ve a problem (screenshot 3 and 4) Here’s the code I used :
Option Explicit
Sub addinfo(pages, lignes)
Dim dl As Long
Dim page As String
page = pages
'trouver la dernière ligne du tableau
If Sheets(page).Range("E3") = Empty Then
dl = 3
Else
Sheets(page).ListObjects(1).ListRows.Add
dl = Sheets(page).Range("E2").End(xlDown).Row +
End If
'placer dans le journal spécifique
With Sheets(page)
.Range("E"& dl) = .Range("D7") 'La date
.Range("F"& dl) = Range("D13"& lignes) 'N° de compte débit
.Range("G"& dl) = Range("F13"& lignes) 'N° de compte crédit
.Range("J"& dl) = Range("G13"& lignes) 'Montant débit
.Range("K"& dl) = Range("H13"& lignes) 'Montant crédit
.Range("L"& dl) = Range("D9") 'libellé d'opération
End With
End Sub