OVH Cloud OVH Cloud

Y a-t-il moyen de raccourcir cela ?

6 réponses
Avatar
Denys
Bonjour à tous,

Auriez-vous le moyen de raccourcir les instructions suivantes ?

Sub BorduresV()
With ActiveSheet.Range("AO100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AP100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AQ100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AR100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With

End Sub

6 réponses

Avatar
isabelle
bonjour Denys,

le résultat du .End(xlUp) est il la même ligne pour les 4 colonnes ?

isabelle


Bonjour à tous,

Auriez-vous le moyen de raccourcir les instructions suivantes ?

Sub BorduresV()
With ActiveSheet.Range("AO100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AP100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AQ100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AR100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With

End Sub




Avatar
Daniel
Bonsoir.
C'est plus court, mais est-ce plus rapide ?

With Union(Range("AO100").End(xlUp), Range("AP100").End(xlUp), _
Range("AQ100").End(xlUp), Range("AR100").End(xlUp))
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With

Cordialement.
Daniel
"Denys" a écrit dans le message de news:

Bonjour à tous,

Auriez-vous le moyen de raccourcir les instructions suivantes ?

Sub BorduresV()
With ActiveSheet.Range("AO100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AP100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AQ100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AR100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With

End Sub




Avatar
Denys
Bonjour Isabelle,

Oui, le résultat est le même.

Merci

Denys


bonjour Denys,

le résultat du .End(xlUp) est il la même ligne pour les 4 colonnes ?

isabelle


Bonjour à tous,

Auriez-vous le moyen de raccourcir les instructions suivantes ?

Sub BorduresV()
With ActiveSheet.Range("AO100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AP100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AQ100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AR100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With

End Sub







Avatar
isabelle
Sub BorduresV()
With ActiveSheet
.Range("AO" & .Range("AO100").End(xlUp) & ":AR" & .Range("AO100").End(xlUp)).BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
End Sub

isabelle


Bonjour Isabelle,

Oui, le résultat est le même.

Merci

Denys



bonjour Denys,

le résultat du .End(xlUp) est il la même ligne pour les 4 colonnes ?

isabelle



Bonjour à tous,

Auriez-vous le moyen de raccourcir les instructions suivantes ?

Sub BorduresV()
With ActiveSheet.Range("AO100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AP100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AQ100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AR100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With

End Sub









Avatar
isabelle
correction,

Sub BorduresV()
With ActiveSheet
x = .Range("AO100").End(xlUp).Row
For Each c In .Range("AO" & x & ":AR" & x)
c.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
Next
End With
End Sub

isabelle


Sub BorduresV()
With ActiveSheet
.Range("AO" & .Range("AO100").End(xlUp) & ":AR" &
.Range("AO100").End(xlUp)).BorderAround ColorIndex:=xlAutomatic,
Weight:=xlThin
End With
End Sub

isabelle


Bonjour Isabelle,

Oui, le résultat est le même.

Merci

Denys



bonjour Denys,

le résultat du .End(xlUp) est il la même ligne pour les 4 colonnes ?

isabelle



Bonjour à tous,

Auriez-vous le moyen de raccourcir les instructions suivantes ?

Sub BorduresV()
With ActiveSheet.Range("AO100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AP100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AQ100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AR100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
End Sub











Avatar
Denys
Bonjour Isabelle et Daniel,

Merci beaucoup... Tout est parfait.

Bonne journée

Denys


correction,

Sub BorduresV()
With ActiveSheet
x = .Range("AO100").End(xlUp).Row
For Each c In .Range("AO" & x & ":AR" & x)
c.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
Next
End With
End Sub

isabelle


Sub BorduresV()
With ActiveSheet
.Range("AO" & .Range("AO100").End(xlUp) & ":AR" &
.Range("AO100").End(xlUp)).BorderAround ColorIndex:=xlAutomatic,
Weight:=xlThin
End With
End Sub

isabelle


Bonjour Isabelle,

Oui, le résultat est le même.

Merci

Denys



bonjour Denys,

le résultat du .End(xlUp) est il la même ligne pour les 4 colonnes ?

isabelle



Bonjour à tous,

Auriez-vous le moyen de raccourcir les instructions suivantes ?

Sub BorduresV()
With ActiveSheet.Range("AO100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AP100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AQ100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
With ActiveSheet.Range("AR100").End(xlUp)
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
End Sub