Sub test_I()
Efface_Zone_Imp '<- pour test
With ActiveSheet
'ligne ci-dessous juste pour test
MsgBox Application.Rept("Zone impression non-définie", Len(.PageSetup.PrintArea) = 0), vbInformation, "Test"
.PageSetup.PrintArea = .UsedRange.Address
MsgBox "Zone d'impression= " & .UsedRange.Address, vbExclamation '<- pour test
End With
End Sub
Sub test_II()
Dim Li&, Co&
Efface_Zone_Imp '<- pour test
With ActiveSheet
'ligne ci-dessous juste pour test
MsgBox Application.Rept("Zone impression non-définie", Len(.PageSetup.PrintArea) = 0), vbInformation, "Test"
Li = .Cells.Find("*", LookIn:=-4123, SearchOrder:=1, SearchDirection:=2).Row
Co = .Cells.Find("*", LookIn:=-4123, SearchOrder:=2, SearchDirection:=2).Column
.PageSetup.PrintArea = .[A1].Resize(Li, Co).Address
MsgBox "Zone d'impression= " & .[A1].Resize(Li, Co).Address, vbExclamation '<- pour test
End With
End Sub
Sub Efface_Zone_Imp()
ActiveSheet.PageSetup.PrintArea = ""
End Sub