Erreur d'exécution '13': Incompatibilité de type

AJIGO

XLDnaute Nouveau
Bonjour,

Mon boucle ne fonctionne pas. Je ne sais pas d'où vient le problème

Dim i As Long For i = 2 To Cells(Rows.Count, "A").End(xlUp).Row If Not IsEmpty(Cells(i, "F")) Then If Cells(i, "K") > 0 And Cells(i, "K") < 1000 And Year(Cells(i, "F")) < (Year(Now) - 1) Then Cells(i, "I") = "PROBLEME" End If Next i

Merci
 

Pièces jointes

  • AJIGO_Tim.xlsm
    27.3 KB · Affichages: 4

Hasco

XLDnaute Barbatruc
Repose en paix
Bonjour,

Il manque des dates en colonne F alors il faut modifier le test:
VB:
Sub Test()

Dim i As Long

For i = 2 To Cells(Rows.Count, "A").End(xlUp).Row
    If IsDate(Cells(i, "F")) Then
        If Cells(i, "K") > 0 And Cells(i, "K") < 1000 And Year(Cells(i, "F")) < (Year(Now) - 1) Then Cells(i, "I") = "PROBLEME"
    End If
Next i

End Sub

Pour ne travailler que sur les lignes dont la colonne F est une date.

A bientôt
 

Discussions similaires

Statistiques des forums

Discussions
312 184
Messages
2 086 007
Membres
103 088
dernier inscrit
Psodam