Sub Stockage()
If IsError([B12]) Then Exit Sub
Dim F As Worksheet, derlig&
Set F = Feuil3 'CodeName feuille Devis
With Feuil4 'CodeName feuille Stockage
If .FilterMode Then .ShowAllData 'si la feuille est filtrée
derlig = .Cells(.Rows.Count, 3).End(xlUp).Row
If derlig = 1 Then
derlig = -3
Else
.HPageBreaks.Add Before:=.Rows(derlig + 4) 'saut de ligne
End If
If IsNumeric(Application.Match(F.[C15], .[C:C], 0)) Then _
If MsgBox("le nom '" & F.[C15] & "' est déjà stocké, voulez-vous continuer ?", 52) = 7 Then Exit Sub
F.[A1:D26].Copy .Cells(derlig + 4, 1) 'pour copier les formats
.Cells(derlig + 4, 1).Resize(26, 4) = F.[A1:D26].Value 'copie les valeurs
.PageSetup.PrintArea = "$A$1:$D$" & derlig + 29 'zone d'impression
'.Activate 'facultatif
End With
End Sub
Sub PDF()
Dim nomfich$
nomfich = ThisWorkbook.Path & "\Devis " & Format(Now, "yyyy-mm-dd hh.mm.ss") 'à adapter
With Feuil4 'CodeName feuille Stockage
If Application.CountA(.[B:B]) Then .ExportAsFixedFormat xlTypePDF, nomfich, Quality:=xlQualityStandard
End With
End Sub
Sub RAZ()
Dim o As Object
Application.ScreenUpdating = False
With Feuil4 'CodeName feuille Stockage
For Each o In .DrawingObjects
If o.TopLeftCell.Column = 1 Then o.Delete
Next
.[A:D].Clear
.PageSetup.PrintArea = "$A:$D"
End With
End Sub