Ilino
XLDnaute Barbatruc
Bonsoir Forum
quelqu’un peut m'aider ou m'explique le bug suivant :
Erreur d’exécution 13
Im compatibilité de type
a ce niveau du code
et le code complet est :
Grazie
quelqu’un peut m'aider ou m'explique le bug suivant :
Erreur d’exécution 13
Im compatibilité de type
a ce niveau du code
Code:
While Format(c2, "dddd") = WE Or Format(c2 - 1, "dddd") = WE Or _
Application.CountIf([Fériés], Int(c2)) 'si le jour n'est pas ouvré
et le code complet est :
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'________ LA DUREE DE TRAITEMENT _________
'lignes de titres en lignes 1 et 2
Dim r As Range, WE$, c1 As Range, c2 As Range, c3 As Range, i&, n&
If Not Intersect(Target, [AL3]) Is Nothing Then
If [AL3] = "" Then [AL3] = "Samedi - Dimanche" Else [T:T].Copy [T1]
Exit Sub
End If
Set r = Intersect([K:K,O:O,T:T], Rows("3:" & Rows.Count))
Set r = Intersect(Target, r, Me.UsedRange)
If Not r Is Nothing Then
WE = LCase(Trim(Split([AL3], "-")(0))) '1er jour du week-end (paramétrage)
Application.EnableEvents = False 'désactive les événements
For Each r In r 'si plusieurs cellules (copier-coller)
Set c1 = Cells(r.Row, "O"): Set c2 = Cells(r.Row, "K"): Set c3 = Cells(r.Row, "T")
If Not IsDate(c1) Then c1 = ""
If IsDate(c2) Then If c2 < c1 Then c2 = ""
If IsDate(c2) Then
While Format(c2, "dddd") = WE Or Format(c2 - 1, "dddd") = WE Or _
Application.CountIf([Fériés], Int(c2)) 'si le jour n'est pas ouvré
c2 = c2 + 1
Wend
If IsDate(c1) Then 'nombre de jours ouvrés
n = 0 'RAZ
For i = Int(c1) To Int(c2)
If Format(i, "dddd") <> WE And Format(i - 1, "dddd") <> WE And _
Application.CountIf([Fériés], i) = 0 Then n = n + 1
Next
c3 = n 'colonne S
Else
c3 = "" 'colonne S
End If
Else
c2 = IIf(IsDate(c1), "Date en attente", "")
c3 = "" 'colonne S
End If
Next
Application.EnableEvents = True 'réactive les événements
End If