Sub contrôle()
Dim datas, lig As Long, col As Long
Dim anoH As Long, anoNbr As Long, msg As String
datas = Worksheets("Rapport").[I28:L74].Value
For col = 1 To UBound(datas, 2)
For lig = 1 To UBound(datas, 1)
If datas(lig, col) = "" Then
anoH = anoH + 1
ElseIf IsNumeric(datas(lig, col)) Then
If datas(lig, col) < 0 Or datas(lig, col) >= 1 Then anoH = anoH + 1
Else
anoH = anoH + 1
End If
Next lig
Next col
datas = Worksheets("Rapport").[M28:M74].Value
For lig = 1 To UBound(datas)
If IsNumeric(datas(lig, 1)) Then
If datas(lig, 1) < 100000 Or datas(lig, 1) > 999999 Then anoNbr = anoNbr + 1
Else
anoNbr = anoNbr + 1
End If
Next lig
If anoH Then msg = anoH & " anomalies de saisie heures"
If anoNbr Then msg = msg & vbLf & anoNbr & " anomalies de saisie nombres"
If msg <> "" Then MsgBox msg: Exit Sub
' suite du code
' ...
End Sub