Private Sub CommandButton1_Click()
Dim w As Worksheet
On Error GoTo 1
For Each w In Worksheets
w.PageSetup.PrintArea = IIf(TextBox1 & TextBox2 = "", "", TextBox1 & ":" & TextBox2)
Next
On Error GoTo 0
Unload Me
Sheets("FGP 2014").PrintOut
Exit Sub
1 MsgBox "Référence non valide !", 48
If TypeName(Evaluate("'" & w.Name & "'!" & TextBox1 & ":A1")) <> "Range" Then
TextBox1.SetFocus: TextBox1.SelStart = 0: TextBox1.SelLength = Len(TextBox1)
Else
TextBox2.SetFocus: TextBox2.SelStart = 0: TextBox2.SelLength = Len(TextBox2)
End If
End Sub