OVH Cloud OVH Cloud

VBA, appliquer un même format à plusieurs plages

4 réponses
Avatar
Domi
Bonsoir, avec l'enregistreur j'ai obtenu cette macro qui donne un format
donné à une plage nommée "toto".
Je doit applique ce même format à d'autre plages nommées "riri", "fifi" et
"loulou", Comment l'appliquer à toutes les plages en une seule fois ?
De plus et accessoirement, est-il possible de simplifier ces nombreuses
lignes. (Le but c'est simplement d'encadrer la plage avec un trait noir
épais)
Merci
Domi

Sub TraitsGras()
Application.Goto Reference:="toto"
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End sub

4 réponses

Avatar
isabelle
bonjour Domi,

Sub TraitsGras()
With Application.Union(Range("riri"), Range("fifi"), Range("loulou"))
.Borders(5).LineStyle = xlNone
.Borders(6).LineStyle = xlNone
For i = 7 To 12
With .Borders(i)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Next
End With
End Sub

isabelle

Bonsoir, avec l'enregistreur j'ai obtenu cette macro qui donne un format
donné à une plage nommée "toto".
Je doit applique ce même format à d'autre plages nommées "riri", "fifi" et
"loulou", Comment l'appliquer à toutes les plages en une seule fois ?
De plus et accessoirement, est-il possible de simplifier ces nombreuses
lignes. (Le but c'est simplement d'encadrer la plage avec un trait noir
épais)
Merci
Domi

Sub TraitsGras()
Application.Goto Reference:="toto"
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End sub




Avatar
Domi
Impeccable pour le "tir groupé" mais je voudrais juste le tour en gras,
alors que là j'ai tout...
Que faut-il modifier ?
Merci
Domi

(Oups pur l'envoi direct...)

"isabelle" a écrit dans le message de
news:
bonjour Domi,

Sub TraitsGras()
With Application.Union(Range("riri"), Range("fifi"), Range("loulou"))
.Borders(5).LineStyle = xlNone
.Borders(6).LineStyle = xlNone
For i = 7 To 12
With .Borders(i)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Next
End With
End Sub

isabelle

Bonsoir, avec l'enregistreur j'ai obtenu cette macro qui donne un
format


donné à une plage nommée "toto".
Je doit applique ce même format à d'autre plages nommées "riri", "fifi"
et


"loulou", Comment l'appliquer à toutes les plages en une seule fois ?
De plus et accessoirement, est-il possible de simplifier ces nombreuses
lignes. (Le but c'est simplement d'encadrer la plage avec un trait noir
épais)
Merci
Domi

Sub TraitsGras()
Application.Goto Reference:="toto"
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End sub






Avatar
Jacky
Bonsoir
'---
For i = 7 To 10
'---
'---
Salutations
JJ

"Domi" a écrit dans le message de news:
uY0$
Impeccable pour le "tir groupé" mais je voudrais juste le tour en gras,
alors que là j'ai tout...
Que faut-il modifier ?
Merci
Domi

(Oups pur l'envoi direct...)

"isabelle" a écrit dans le message de
news:
bonjour Domi,

Sub TraitsGras()
With Application.Union(Range("riri"), Range("fifi"), Range("loulou"))
.Borders(5).LineStyle = xlNone
.Borders(6).LineStyle = xlNone
For i = 7 To 12
With .Borders(i)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Next
End With
End Sub

isabelle

Bonsoir, avec l'enregistreur j'ai obtenu cette macro qui donne un
format


donné à une plage nommée "toto".
Je doit applique ce même format à d'autre plages nommées "riri", "fifi"
et


"loulou", Comment l'appliquer à toutes les plages en une seule fois ?
De plus et accessoirement, est-il possible de simplifier ces nombreuses
lignes. (Le but c'est simplement d'encadrer la plage avec un trait noir
épais)
Merci
Domi

Sub TraitsGras()
Application.Goto Reference:="toto"
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End sub










Avatar
Domi
Nickel ;o)
Merci
Domi
"Jacky" a écrit dans le message de
news:%
Bonsoir
'---
For i = 7 To 10
'---
'---
Salutations
JJ

"Domi" a écrit dans le message de news:
uY0$
Impeccable pour le "tir groupé" mais je voudrais juste le tour en gras,
alors que là j'ai tout...
Que faut-il modifier ?
Merci
Domi

(Oups pur l'envoi direct...)

"isabelle" a écrit dans le message de
news:
bonjour Domi,

Sub TraitsGras()
With Application.Union(Range("riri"), Range("fifi"), Range("loulou"))
.Borders(5).LineStyle = xlNone
.Borders(6).LineStyle = xlNone
For i = 7 To 12
With .Borders(i)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Next
End With
End Sub

isabelle

Bonsoir, avec l'enregistreur j'ai obtenu cette macro qui donne un
format


donné à une plage nommée "toto".
Je doit applique ce même format à d'autre plages nommées "riri",
"fifi"




et
"loulou", Comment l'appliquer à toutes les plages en une seule fois ?
De plus et accessoirement, est-il possible de simplifier ces
nombreuses




lignes. (Le but c'est simplement d'encadrer la plage avec un trait
noir




épais)
Merci
Domi

Sub TraitsGras()
Application.Goto Reference:="toto"
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End sub