Dim datas, datas2, lig As Long, col As Long
Dim anoH As Long, anoNbr As Long, ano As Boolean, nbLig As Long, msg As String
Dim nNom$
datas = Worksheets("Rapport").[I28:L74].Value
Worksheets("Rapport").[I28:L74].Interior.ColorIndex = xlNone
datas2 = Worksheets("Rapport").[M28:M74].Value
For lig = 1 To UBound(datas, 1)
If IsNumeric(datas2(lig, 1)) = False Or datas2(lig, 1) <> "" Then
nbLig = nbLig + 1
' contrôle nombre
ano = False
If IsNumeric(datas2(lig, 1)) Then
If datas2(lig, 1) < 100000 Or datas2(lig, 1) > 999999 Then anoNbr = anoNbr + 1: ano = True
End If
If ano Then Range("M27").Offset(lig).Interior.Color = vbYellow
' contrôle heures
For col = 1 To UBound(datas, 2)
ano = False
If datas(lig, col) = "" Then
anoH = anoH + 1: ano = True
ElseIf IsNumeric(datas(lig, col)) Then
If datas(lig, col) < 0 Or datas(lig, col) >= 1 Then anoH = anoH + 1: ano = True
End If
If ano Then Range("H27").Offset(lig, col).Interior.Color = vbYellow
Next col
End If
Next lig
If anoH + anoNbr > 0 Then
msg = nbLig & " lignes contrôlées :" & vbLf
If anoH Then msg = msg & anoH & " anomalie(s) de saisie heures"
If anoNbr Then msg = msg & vbLf & anoNbr & " anomalie(s) de saisie nombres"
End If
If msg <> "" Then MsgBox msg: Exit Sub
' suite du code