Re : Masquer un nombre très important de lignes vides
Bonjour
voici un exemple de macro à adapter
Public Sub Clearvalues()
'OBJECTIF IDENTIFIER DES LIGNES à 0 POUR LES VIDER
Dim K&, Kc&, Y&, Tmp As Object, Plage As Range
Dim Tablo() As Variant, Ctd As Collection
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
'Feuil2.Activate
Y = Cells(65536, 1).End(xlUp).Row
ReDim Tablo(1 To Y, 1)
For Y = 2 To Y
Tablo(Y, 1) = Cells(Y, 3) + Cells(Y, 4) + Cells(Y, 5)
Next
For Y = 2 To UBound(Tablo)
Range("G" & Y) = Tablo(Y, 1)
Next
'Kc=La colonne à traiter
Kc = 7
Set Ctd = New Collection
Set Plage = Range(Cells(2, Kc), Cells(Y, Kc))
With Plage
For Each Tmp In Plage
If Tmp.Value = 0 Then
'stockage des numeros de lignes à 0
Ctd.Add Tmp.Row, CStr(Tmp.Row)
End If
Next
End With
If Ctd.Count = 0 Then Exit Sub
'definition de la plage des lignes à 0
For K = 1 To Ctd.Count
'Range("E" & Ctd(K)).Value = Ctd(K)
If K = 1 Then Set Plage = Rows(Ctd(K))
Set Plage = Union(Plage, Rows(Ctd(K)))
Next
'Marquage ou Raz des lignes à 0
With Plage
'.Interior.ColorIndex = 33 'AU CHOIX
.Delete 'AU CHOIX
End With
Range("g:g").ClearContents
Application.Calculation = xlCalculationAutomatic
Set Plage = Nothing: Set Ctd = Nothing
Cells(2, 3).Activate
End Sub