Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
MichDenis
Bonsoir j-pascal,
Essaie ceci :
'------------------------------------------------ Sub Formatage()
Dim Rg As Range, Rg1 As Range, C As Range Set Rg = Worksheets(1).Range("L8:L202")
Application.ScreenUpdating = False For Each c In Rg If c.Value = 1 Then Set Rg1 = c.Offset(, -9).Resize(, 10) With Rg1.Borders(xlEdgeBottom) .LineStyle = xlDash .Weight = xlMedium .ColorIndex = 32 End With Else Set Rg1 = c.Offset(, -9).Resize(, 10) aa = Rg1.Address With Rg1.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = 16 End With End If Next Set Rg1 = Nothing: Set Rg = Nothing: Set C = Nothing
End Sub '------------------------------------------------
Salutations!
"j-pascal" a écrit dans le message de news: % Bonjour à tous, Cette portion de code me paraît très lourde, pourriez-vous me dire comment la simplifier ? D'avance, merci !
End With End With End With End With End With End With End With End With End With
End If
Next
End Sub
Bonsoir j-pascal,
Essaie ceci :
'------------------------------------------------
Sub Formatage()
Dim Rg As Range, Rg1 As Range, C As Range
Set Rg = Worksheets(1).Range("L8:L202")
Application.ScreenUpdating = False
For Each c In Rg
If c.Value = 1 Then
Set Rg1 = c.Offset(, -9).Resize(, 10)
With Rg1.Borders(xlEdgeBottom)
.LineStyle = xlDash
.Weight = xlMedium
.ColorIndex = 32
End With
Else
Set Rg1 = c.Offset(, -9).Resize(, 10)
aa = Rg1.Address
With Rg1.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 16
End With
End If
Next
Set Rg1 = Nothing: Set Rg = Nothing: Set C = Nothing
End Sub
'------------------------------------------------
Salutations!
"j-pascal" <nospam-j-pascal@free.fr> a écrit dans le message de news: %23rmY5YJEFHA.392@TK2MSFTNGP14.phx.gbl...
Bonjour à tous,
Cette portion de code me paraît très lourde, pourriez-vous me dire comment
la simplifier ? D'avance, merci !
'------------------------------------------------ Sub Formatage()
Dim Rg As Range, Rg1 As Range, C As Range Set Rg = Worksheets(1).Range("L8:L202")
Application.ScreenUpdating = False For Each c In Rg If c.Value = 1 Then Set Rg1 = c.Offset(, -9).Resize(, 10) With Rg1.Borders(xlEdgeBottom) .LineStyle = xlDash .Weight = xlMedium .ColorIndex = 32 End With Else Set Rg1 = c.Offset(, -9).Resize(, 10) aa = Rg1.Address With Rg1.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = 16 End With End If Next Set Rg1 = Nothing: Set Rg = Nothing: Set C = Nothing
End Sub '------------------------------------------------
Salutations!
"j-pascal" a écrit dans le message de news: % Bonjour à tous, Cette portion de code me paraît très lourde, pourriez-vous me dire comment la simplifier ? D'avance, merci !
End With End With End With End With End With End With End With End With End With
End If
Next
End Sub
MichDenis
Bonsoir j-pascal,
Essaie ceci :
'--------------------------------------- Sub Formatage()
Dim Rg As Range, Rg1 As Range Set Rg = Worksheets(1).Range("L8:L202")
Application.ScreenUpdating = False For Each c In Rg If c.Value = 1 Then Set Rg1 = c.Offset(, -9).Resize(, 10) With Rg1.Borders(xlEdgeBottom) .LineStyle = xlDash .Weight = xlMedium .ColorIndex = 32 End With Else Set Rg1 = c.Offset(, -9).Resize(, 10) With Rg1.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = 16 End With End If Next End Sub '---------------------------------------
Salutations!
"j-pascal" a écrit dans le message de news: % Bonjour à tous, Cette portion de code me paraît très lourde, pourriez-vous me dire comment la simplifier ? D'avance, merci !
End With End With End With End With End With End With End With End With End With
End If
Next
End Sub
Bonsoir j-pascal,
Essaie ceci :
'---------------------------------------
Sub Formatage()
Dim Rg As Range, Rg1 As Range
Set Rg = Worksheets(1).Range("L8:L202")
Application.ScreenUpdating = False
For Each c In Rg
If c.Value = 1 Then
Set Rg1 = c.Offset(, -9).Resize(, 10)
With Rg1.Borders(xlEdgeBottom)
.LineStyle = xlDash
.Weight = xlMedium
.ColorIndex = 32
End With
Else
Set Rg1 = c.Offset(, -9).Resize(, 10)
With Rg1.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 16
End With
End If
Next
End Sub
'---------------------------------------
Salutations!
"j-pascal" <nospam-j-pascal@free.fr> a écrit dans le message de news: %23rmY5YJEFHA.392@TK2MSFTNGP14.phx.gbl...
Bonjour à tous,
Cette portion de code me paraît très lourde, pourriez-vous me dire comment
la simplifier ? D'avance, merci !
'--------------------------------------- Sub Formatage()
Dim Rg As Range, Rg1 As Range Set Rg = Worksheets(1).Range("L8:L202")
Application.ScreenUpdating = False For Each c In Rg If c.Value = 1 Then Set Rg1 = c.Offset(, -9).Resize(, 10) With Rg1.Borders(xlEdgeBottom) .LineStyle = xlDash .Weight = xlMedium .ColorIndex = 32 End With Else Set Rg1 = c.Offset(, -9).Resize(, 10) With Rg1.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = 16 End With End If Next End Sub '---------------------------------------
Salutations!
"j-pascal" a écrit dans le message de news: % Bonjour à tous, Cette portion de code me paraît très lourde, pourriez-vous me dire comment la simplifier ? D'avance, merci !
End With End With End With End With End With End With End With End With End With
End If
Next
End Sub
GVentre
Bonjour J-pascal,
plus léger en appliquant le style non pas cellule par cellule mais sur la plage de cellule:
Sub test() For Each c In Worksheets(1).Range("L8:L222") If c.Value = 1 Then With Range(c.Offset(0, -1), c.Offset(0, -9)).Borders(xlEdgeBottom) .LineStyle = xlDash .Weight = xlMedium .ColorIndex = 32
End With Else With Range(c.Offset(0, -1), c.Offset(0, -9)).Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = 16
End With End If Next End Sub
Cordialement, GVentre
Bonjour à tous, Cette portion de code me paraît très lourde, pourriez-vous me dire comment la simplifier ? D'avance, merci !
End With End With End With End With End With End With End With End With End With
End If
Next
End Sub
Bonjour J-pascal,
plus léger en appliquant le style non pas cellule par cellule mais sur
la plage de cellule:
Sub test()
For Each c In Worksheets(1).Range("L8:L222")
If c.Value = 1 Then
With Range(c.Offset(0, -1), c.Offset(0, -9)).Borders(xlEdgeBottom)
.LineStyle = xlDash
.Weight = xlMedium
.ColorIndex = 32
End With
Else
With Range(c.Offset(0, -1), c.Offset(0, -9)).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 16
End With
End If
Next
End Sub
Cordialement,
GVentre
Bonjour à tous,
Cette portion de code me paraît très lourde, pourriez-vous me dire comment
la simplifier ? D'avance, merci !
plus léger en appliquant le style non pas cellule par cellule mais sur la plage de cellule:
Sub test() For Each c In Worksheets(1).Range("L8:L222") If c.Value = 1 Then With Range(c.Offset(0, -1), c.Offset(0, -9)).Borders(xlEdgeBottom) .LineStyle = xlDash .Weight = xlMedium .ColorIndex = 32
End With Else With Range(c.Offset(0, -1), c.Offset(0, -9)).Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = 16
End With End If Next End Sub
Cordialement, GVentre
Bonjour à tous, Cette portion de code me paraît très lourde, pourriez-vous me dire comment la simplifier ? D'avance, merci !