1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
Private Function Arrondi(ByVal Nombre, ByVal Decimales)
Arrondi = Int(Nombre * 10 ^ Decimales + 1 / 2) / 10 ^ Decimales
End Function
Sub vba()
Dim DernLigne As Long
Dim Sommetotal As Long
Dim Fs As Object, A As Object
Dim i As Long
feuille = Sheets("information").Range("B6").Value
Code = Sheets("information").Range("c6").Value
typeecriture = Sheets("information").Range("E6").Value
Sheets(feuille).Select
DernLigne = Sheets(feuille).Range("A65536").End(xlUp).Row
date_export = Replace(Sheets("information").Range("D6").Value, "/", "-")
Set Fs = CreateObject("Scripting.FileSystemObject")
Set A = Fs.CreateTextFile("J:\Comptabilite\Documents\" & date_export & ".txt", True)
A.WriteLine ("Type Ecriture Code Journal Date de Pièce N° Compte Général N° Compte tiers Libellé d'écriture Montant débit Montant crédit N°Plan N° section")
For i = 1 To DernLigne
If Sheets(feuille).Range("C" & i).Value <> "" Then
A.WriteLine (typeecriture & vbTab & Code & vbTab & date_export & vbTab & Range("C" & i) & vbTab & vbTab & Range("A" & i) & vbTab & Range("D" & i) & vbTab & Range("E" & i) & vbTab & vbTab)
Else
End If
Next
A.Close
End Sub |
Partager