Bonjour,
Je suis entrain de construire une petite mais utile macro de mise en forme.
Une étape consiste à appliquer une mise en forme en fonction du nombre d'espaces vides dans la premiere cellule et celà fonctionne. je voudrais pouvoir appliquer cette mise en forme à toute la ligne, mais je n'y parviens pas.
Un message d'erreur 1004 s'affiche.
Je pensais y parvenir en changeant la plage de sélection mais celà ne suffit pas.
Quelqu'un peut-il m'aider?
merci beaucoup par avance.
romain
Columns("A:A").Select
Selection.NumberFormat = "General"
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=CHERCHE(STXT(SUPPRESPACE(A1);1;1);A1)-1=0"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Borders(xlLeft)
.LineStyle = xlContinuous
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.FormatConditions(1).Borders(xlRight)
.LineStyle = xlContinuous
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.FormatConditions(1).Borders(xlTop)
.LineStyle = xlContinuous
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.FormatConditions(1).Borders(xlBottom)
.LineStyle = xlContinuous
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 10498160
.TintAndShade = 0
End With
Je suis entrain de construire une petite mais utile macro de mise en forme.
Une étape consiste à appliquer une mise en forme en fonction du nombre d'espaces vides dans la premiere cellule et celà fonctionne. je voudrais pouvoir appliquer cette mise en forme à toute la ligne, mais je n'y parviens pas.
Un message d'erreur 1004 s'affiche.
Je pensais y parvenir en changeant la plage de sélection mais celà ne suffit pas.
Quelqu'un peut-il m'aider?
merci beaucoup par avance.
romain
Columns("A:A").Select
Selection.NumberFormat = "General"
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=CHERCHE(STXT(SUPPRESPACE(A1);1;1);A1)-1=0"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Borders(xlLeft)
.LineStyle = xlContinuous
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.FormatConditions(1).Borders(xlRight)
.LineStyle = xlContinuous
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.FormatConditions(1).Borders(xlTop)
.LineStyle = xlContinuous
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.FormatConditions(1).Borders(xlBottom)
.LineStyle = xlContinuous
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 10498160
.TintAndShade = 0
End With