Private Sub PegaIdade ()
Dim wqtAnos As Integer, wdtNasc As Date, wStrData
wstrData = InputBox("Informe a data de nascimento", "Data de nascimento", "")
if not isdate(wstrdata) then exit sub
wdtNasc=wstrData
wqtAnos = DateDiff("d", wdtNasc, Date) / 365
If wqtAnos > 4 And wqtAnos < 8 Then
MsgBox "Infantil A"
ElseIf wqtAnos > 7 And wqtAnos < 12 Then
MsgBox "Infantil B"
ElseIf wqtAnos > 11 And wqtAnos < 14 Then
MsgBox "Juvenil A"
ElseIf wqtAnos > 13 And wqtAnos < 18 Then
MsgBox "Juvenil B"
ElseIf wqtAnos > 17 Then
MsgBox "Adultos"
End If
End Sun