Bonsoir à tous,
Y-a-t-il une possibilité, (en VBA), de colorer les colonnes de 3 tableaux, dans trois feuilles différentes, sous 2 conditions? Les trois conditions des MFC ne sont plus disponibles.
Dans la macro suivante (qui fonctionne), je n'ai pas de solution pour la deuxième condition: (Si cellule A10 est vide, alors aucune cellule ne devrait être colorée sur la ligne 10).
Merci pour votre aide.
Cordialement,
Chaly
**************************************************************
Code dans "module 1":
Sub ColorRange()
ColorCell Range("B4:AF5")
End Sub
Sub ColorCell(Rge As Range)
Dim i As Integer
Dim Cell As Range
Dim Ws As Worksheet
For Each Ws In ThisWorkbook.Sheets
Ws.Range("A4:AF40").Interior.ColorIndex = xlNone
For Each Cell In Ws.Range("A4:AF40")
For i = 1 To 37
If Cell.Value = "Sa" Or Cell.Value = "Di" Then Cell.Resize(37, 1).Interior.ColorIndex = 15
'***************************************************************
'La ligne suivante (Condition sur la colonne A) ne fonctionne malheureusement pas:
'If Cell.Value = "Sa" Or Cell.Value = "Di" And Cell.Range("A6:A40").Value <> "" Then Cell.Offset(i - 1, 0).Interior.ColorIndex = 15
'***************************************************************
Next i
Next Cell
Next Ws
End Sub
Y-a-t-il une possibilité, (en VBA), de colorer les colonnes de 3 tableaux, dans trois feuilles différentes, sous 2 conditions? Les trois conditions des MFC ne sont plus disponibles.
Dans la macro suivante (qui fonctionne), je n'ai pas de solution pour la deuxième condition: (Si cellule A10 est vide, alors aucune cellule ne devrait être colorée sur la ligne 10).
Merci pour votre aide.
Cordialement,
Chaly
**************************************************************
Code dans "module 1":
Sub ColorRange()
ColorCell Range("B4:AF5")
End Sub
Sub ColorCell(Rge As Range)
Dim i As Integer
Dim Cell As Range
Dim Ws As Worksheet
For Each Ws In ThisWorkbook.Sheets
Ws.Range("A4:AF40").Interior.ColorIndex = xlNone
For Each Cell In Ws.Range("A4:AF40")
For i = 1 To 37
If Cell.Value = "Sa" Or Cell.Value = "Di" Then Cell.Resize(37, 1).Interior.ColorIndex = 15
'***************************************************************
'La ligne suivante (Condition sur la colonne A) ne fonctionne malheureusement pas:
'If Cell.Value = "Sa" Or Cell.Value = "Di" And Cell.Range("A6:A40").Value <> "" Then Cell.Offset(i - 1, 0).Interior.ColorIndex = 15
'***************************************************************
Next i
Next Cell
Next Ws
End Sub