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
| Sub Archiver()
ligne = Sheets("- Suivi Factures -").Range("A6").End(xlDown).Row + 1
Sheets("- Suivi Factures -").Range("A" & ligne).Value = Sheets("- Facture -").Range("A12").Value
Sheets("- Suivi Factures -").Range("B" & ligne).Value = Sheets("- Facture -").Range("B12").Value
Sheets("- Suivi Factures -").Range("C" & ligne).Value = Sheets("- Facture -").Range("C12").Value
Sheets("- Suivi Factures -").Range("D" & ligne).Value = Sheets("- Facture -").Range("D27").Value
Sheets("- Facture -").Range("B12").ClearContents
Sheets("- Facture -").Range("C12").ClearContents
Sheets("- Facture -").Range("A16:A25").ClearContents
Sheets("- Facture -").Range("B16:B25").ClearContents
Sheets("- Facture -").Range("C16:C25").ClearContents
Sheets("- Facture -").Range("D16:D25").ClearContents
On Error GoTo Num?roUn
N = Right(Range("A12").Value, 5)
Range("A12").Value = "F" & Year(Date) & Month(Date) & "-" & Format(N + 1, "00000")
Exit Sub
NumeroUn:
Range("A12").Value = "F" & Year(Date) & Month(Date) & "-" & Format(1, "00000")
Resume Next
Worksheets("- Facture -").Range("A12").ExportAsFixedFormat Type:=xlTypePDF, _
Filename:="C:\Users\mur_a\Documents\Facture.pdf", _
Quality:=xlQualityStandard, _
IncludedDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End Sub |
Partager