Bonjour a tous,
je suis bloqué dans ma formule et macro... une petite aide serai super.
j'ai un tableau avec plusieurs couleurs em fonction des jours du moi.
j'ai créer une macro pour conter les couleurs : jusqu'ici c'est ok.
j'ai créer une macro pour rechercher la colonne oú se trouve la date que je recherche... ici c'est ok.
Mon probleme c'est que je n'arriver pas a joindre ces deux macros pour conter les cellules en bleu( par exemple) dans la colonne oú se trouve la date que je recherche.
Mes deux macros:
Function CountColorIf(rSample As Range, rArea As Range) As Long
Dim rAreaCell As Range
Dim lMatchColor As Long
Dim lCounter As Long
lMatchColor = rSample.Interior.Color
For Each rAreaCell In rArea
If rAreaCell.Interior.Color = lMatchColor Then
If rAreaCell.Value <> "?" Then
If rAreaCell.Value <> "VA" Then 'VACANCE'
If rAreaCell.Value <> "MA" Then 'MALADIE'
If rAreaCell.Value <> "FR" Then 'FORMATION'
lCounter = lCounter + 1
End If
End If
End If
End If
End If
Next rAreaCell
CountColorIf = lCounter
End Function
Fonction pour trouver la colonne oú se trouve la date que je recherche:
Function ConvertToLetter(iCol As Integer) As String
Dim iAlpha As Integer
Dim iRemainder As Integer
iAlpha = Int(iCol / 27)
iRemainder = iCol - (iAlpha * 26)
If iAlpha > 0 Then
ConvertToLetter = Chr(iAlpha + 64)
End If
If iRemainder > 0 Then
ConvertToLetter = ConvertToLetter & Chr(iRemainder + 64)
End If
End Function
je vous remercie d'avance.