XL 2013 intégration formule si sous vba excel 2013

GwenOll21

XLDnaute Nouveau
Bonjour,

Je souhaiterais intégrer une formule Si sous VBA. J'ai bien lu tous les tutos; Et cela ne fonctionne pas pourriez vous m'aidez?
Si = date de la ligne 9 > date de la ligne 2 => case "colorié" en rouge

1578045711706.png
 

GwenOll21

XLDnaute Nouveau
Après quelques essais sur une case cela fonctionne bien mais dès que j'essaie d'intégrer les colonnes cela ne fonctionne plus.
Voici le code ci dessous

If Range("O13:C130").Value > Range("O7:CT7").Value Then
Range("O13:CT130").Interior.ColorIndex = xlcolorAutomatic
Range("O13:CT130").Interior.ColorIndex = 26

Pouvez-vous m'aider à débuguer ce problème?
 

GwenOll21

XLDnaute Nouveau
La macro ci-dessous sert pour une matrice de formation avec des dates arrivant à échéances. Le problème c'est que dès j'essaie d'incrémenter des colonnes entières pour une date de formation cela me marque error.
Je sais pas si cela peut vous aider.

Sub formation()
Application.ScreenUpdating = True
Sheets("BDD").Activate
Range("A13:CT129").Select
ActiveWorkbook.Worksheets("BDD").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("BDD").Sort.SortFields.Add Key:=Range("L13: L129"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("BDD").Sort
.SetRange Range("A13:CT129")
.Header = xlGuess
.MatchCase = True
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With

For o = 13 To 330
For CT = 13 To 330
Cells(o, CT).Interior.ColorIndex = xlColorIndexNone
If Cells(o, CT).Value <> "" Then
Cells(o, CT).Font.ColorIndex = 3
Cells(o, CT).Font.Bold = True
End If
If (Cells(7, CT).Value <> 0) And (Cells(o, CT).Value + ((Cells(7, CT).Value) * 365)) - 30 < Cells(7, 1).Value Then
Cells(o, CT).Font.ColorIndex = 4
Cells(o, CT).Font.Bold = True
End If
If (Cells(7, CT).Value <> 0) And (Cells(o, CT).Value + (Cells(7, CT).Value) * 365) < Cells(7, 1).Value Then
Cells(o, CT).Font.ColorIndex = 3
Cells(o, CT).Font.Bold = False
End If
If Cells(o, CT).Value = "" Or Cells(o, CT).Font.ColorIndex = 3 Then
If Cells(o, 13).Value <> "" And Cells(6, CT).Value <> "" Then
If Cells(o, 4).Value = "" Then
Select Case Cells(7, CT).Value
Case "0", "CT"
Cells(o, CT).Interior.ColorIndex = xlColorIndexAutomatic
Case Else
Cells(o, CT).Interior.ColorIndex = 24
End Select
End If
End If
End If
Next
Next
Range("A7:CT7").Select
If Range("O13").Value > Range("O7").Value Then
Range("O13").Interior.ColorIndex = xlcolorAutomatic
Range("O13").Interior.ColorIndex = 26
End If
End Sub
 

Discussions similaires

Réponses
3
Affichages
261

Statistiques des forums

Discussions
312 299
Messages
2 086 986
Membres
103 419
dernier inscrit
mk29