Et oui! Il sentent bon les after shave.Ah Ce lien n'existe plus avant le before... souvenirs, souvenirs
Sub MacroSpecialLoupSolitaire()
Dim Lig&, LASTEXIT2NOWHERE As Range
Lig = Cells(Rows.Count, 5).End(xlUp).Row - 1
Set LASTEXIT2NOWHERE = Cells(3, Columns.Count)
With LASTEXIT2NOWHERE
.Resize(Lig - 1).FormulaR1C1 = "=IF(RC5=9,""Lone-Wolf"",0)"
.SpecialCells(-4123, 2).EntireRow.Delete
.ClearContents
End With
End Sub
Sub test1()
'exemples de syntaxe : suppression en colonne 2, valeur par défaut: 9
preparation
LoupSolitaireVeutDuParamétrable "2"
End Sub
Sub test2()
'exemples de syntaxe : ici suppression en colonne 5 si 3
preparation
LoupSolitaireVeutDuParamétrable "5", "3"
End Sub
Private Sub LoupSolitaireVeutDuParamétrable(Colonne, Optional Valeur_Pour_Suppression As String = 9)
Dim Lig&, LASTEXIT2NOWHERE As Range
Lig = Cells(Rows.Count, 1).End(xlUp).Row - 1
Set LASTEXIT2NOWHERE = Cells(2, Columns.Count)
On Error Resume Next
With LASTEXIT2NOWHERE
.Resize(Lig).FormulaR1C1 = _
"=IF(RC" & Colonne & "=" & Valeur_Pour_Suppression & ",""Lone-Wolf"",0)"
.SpecialCells(-4123, 2).EntireRow.Delete
.CurrentRegion.ClearContents
End With
End Sub
Private Sub preparation()
Sheets.Add
Application.ScreenUpdating = False
[A1] = "ITEM1": [A1].AutoFill [A1:H1], 0
[A2:H81].FormulaR1C1 = "=MOD(ROW()*COLUMN(),9)+1"
[A2:H81].Value = [A2:H81].Value
End Sub
Sub Supprimer_9_colonne_E()
With Feuil1.UsedRange 'CodeName de la feuille
If Application.CountIf(.Columns(5), 9) = 0 Then Exit Sub
With .Columns(.Columns.Count + 1) 'colonne auxiliaire
Application.ScreenUpdating = False
If .Parent.FilterMode Then .Parent.ShowAllData 'si la feuille est filtrée
.FormulaR1C1 = "=IF(RC5=9,1/0)"
.Value = .Value 'supprime les formules
.EntireRow.Sort .Cells, xlAscending, Header:=xlYes 'tri pour accélérer
.SpecialCells(xlCellTypeConstants, 16).EntireRow.Delete
.ClearContents
End With
With .Parent.UsedRange: End With 'actualise les barres de défilement
End With
End Sub