Salut !
Ca faisait un moment que je n'était pas passé (donc je dois m'améliorer ).
Là j'ai une petite macro qui test si une cellule contient une formule, et si ce n'est pas le cas la peint en rouge. Ça marche bien, mais j'ai ~130 feuilles à traiter et c'est un peu trop long :p
Voici la macro d'origine :
Dim sh As Worksheet
cell As Range, myrange as Range
For Each sh In Sheets
If IsNumeric(sh.Name) Then
With sh
myrange = Range("O7:AM55,AO7:BM55,BO7:CM55,CO7:DM55") '3 plages dans chaque feuille.
For Each cell In myrange
If Not cell.HasFormula Then
cell.Interior.ColorIndex = 3
End If
Next cell
End With
End If
Next sh
Voici ce que j'essaie de faire avec une variable tableau, mais évidemment ça plante Erreur 1004 à la définition de myrange. Comme il yt a 3 plages, faut-il créer 3 tableaux ?
Dim sh As Worksheet
Dim c1&, c2&, myrange As Variant
For Each sh In Sheets
If IsNumeric(sh.Name) Then
With sh
myrange = Range("O7:AM55,AO7:BM55,BO7:CM55,CO7:DM55")
For c1 = LBound(myrange, 1) To UBound(myrange, 1)
For c2 = LBound(myrange, 2) To UBound(myrange, 2)
If Not myrange(c1, c2).HasFormula Then
myrange(c1, c2).Interior.ColorIndex = 3
End If
Next c2
Next c1
End With
End If
Next sh
Merci d'avance