1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Sub Macro1()
Dim i, j, k As Integer
ActiveSheet.Unprotect 'Password:="ed"
i = Range("LigDep").Value
If WsCent.Cells(i, 1) <> "" Then
j = Range(Cells(i, 1), Cells(i, 1).End(xlDown)).Rows.Count - 1
k = i + j
WsCent.Range(Cells(i, 1), Cells(k, 1)).Select
WsCent.Range(Selection, Selection.End(xlToRight)).Select
Selection.PrintOut Copies:=1, Collate:=True
WsCent.Range("Ligfin") = k
Else
MsgBox "Toutes les feuilles sont déjà imprimées", 48, "Impression"
derligne = ActiveSheet.Range("A1048576").End(xlUp).Row + 1 'recherche dernière ligne col A non utilisé
ActiveSheet.Range("A" & derligne).Select
ActiveSheet.Protect ' Password:="ed"
'ActiveWorkbook.Save 'ici, ici, ici,
End If
End Sub |
Partager