Bonjour Aixel
la deuxième boucle n'est pas la pour rien mais pour traiter les formules, la première boucle traitant les constantes. C'est d'ailleurs la qu'est le problème, cette macro plante sur la première boucle si il n'y a pas de constantes et sur la deuxième si il n'y a pas de formule.
voici le code modifié avec une gestion des erreurs
Cordialement, A+
Sub Macro3()
Dim Cel_en_Cours As Range, Test As Boolean, Range_Test As Range
Test = False
On Error GoTo Gere_Erreurs
Set Range_Test = Range('A1').SpecialCells(xlCellTypeConstants, 23)
On Error GoTo 0
If Test = False Then
For Each Cel_en_Cours In Range('A1').SpecialCells(xlCellTypeConstants, 23)
If Cel_en_Cours.RowHeight > 0 Then
If Cel_en_Cours.Font.ColorIndex = 3 Then
Cel_en_Cours.MergeArea.EntireRow.RowHeight = 0
End If
End If
Next Cel_en_Cours
End If
Test = False
On Error GoTo Gere_Erreurs
Set Range_Test = Range('A1').SpecialCells(xlCellTypeFormulas, 23)
On Error GoTo 0
If Test = False Then
For Each Cel_en_Cours In Range('A1').SpecialCells(xlCellTypeFormulas, 23)
If Cel_en_Cours.RowHeight > 0 Then
If Cel_en_Cours.Font.ColorIndex = 3 Then
Cel_en_Cours.MergeArea.EntireRow.RowHeight = 0
End If
End If
Next Cel_en_Cours
End If
Exit Sub
Gere_Erreurs:
Test = True
Resume Next
End Sub