Private Sub TextBox1_Change()
Dim dNumber As Double
Dim sError As String
Static bEditing As Boolean
If bEditing Then Exit Sub
bEditing = True
If Me.TextBox1 = "" Then GoTo linEnd
If Not IsNumeric(Me.TextBox1) Then
sError = "É obrigatório inserir um número!"
GoTo linFail
End If
dNumber = CDbl(Me.TextBox1)
If dNumber < 1 Or dNumber > 53 Then
sError = "Insira um número entre 1 e 53!"
GoTo linFail
End If
linEnd:
bEditing = False
Exit Sub
linFail:
MsgBox sError, vbExclamation
Me.TextBox1 = ""
GoTo linEnd
End Sub
Felipe Costa Gualberto - http://www.ambienteoffice.com.br