[Catégorie modifiée .Net - VBA] Erreur d'exécution '13':incompatibilité de type

argaz01 Messages postés 37 Date d'inscription lundi 12 janvier 2009 Statut Membre Dernière intervention 10 avril 2012 - 18 juin 2010 à 15:15
cs_Jack Messages postés 14006 Date d'inscription samedi 29 décembre 2001 Statut Modérateur Dernière intervention 28 août 2015 - 18 juin 2010 à 19:14
Bonjour,

Le code suivant m'affiche une erreurd'exécution '13': incompatibilité de type. Merci d'y jeter un coup d'oeil et de m'éclairer.
Sub coul()
Dim c As Range, FC As FormatCondition, F1, x As Long
Application.ScreenUpdating = False
x = 0
For Each c In [P8:P128] 'plage a definir
c.Activate
For Each FC In ActiveCell.FormatConditions
  If FC.Type = xlCellValue Then
    F1 = Evaluate(FC.Formula1)
    Select Case FC.Operator
      Case xlBetween: If ActiveCell >= F1 _
        And ActiveCell <= Evaluate(FC.Formula2) Then Exit For
      Case xlEqual: If ActiveCell = F1 Then Exit For
      Case xlGreater: If ActiveCell > F1 Then Exit For
      Case xlGreaterEqual: If ActiveCell >= F1 Then Exit For
      Case xlLess: If ActiveCell < F1 Then Exit For
      Case xlLessEqual: If ActiveCell <= F1 Then Exit For
      Case xlNotBetween: If ActiveCell < F1 _
        Or ActiveCell > Evaluate(FC.Formula2) Then Exit For
      Case xlNotEqual: If ActiveCell <> F1 Then Exit For
    End Select
  Else
    If Evaluate(FC.Formula1) Then Exit For
  End If
Next FC
If Not FC Is Nothing Then
If FC.Interior.ColorIndex 3 Then x x + 1 'index couleur= 3 rouge
End If
Next c
MsgBox x 'variable a utiliser
End Sub

1 réponse

cs_Jack Messages postés 14006 Date d'inscription samedi 29 décembre 2001 Statut Modérateur Dernière intervention 28 août 2015 79
18 juin 2010 à 19:14
Salut
Sur quelle ligne, cette erreur ?

Vala
Jack, MVP VB
NB : Je ne répondrai pas aux messages privés

Le savoir est la seule matière qui s'accroit quand on la partage (Socrate)
0
Rejoignez-nous