Private Sub CommandButton1_Click()
Dim test As Boolean, a, i&, n&
With CommandButton1
test = .Caption Like "S*"
.Caption = IIf(test, "Insérer", "Supprimer") & " lignes vides"
.ForeColor = IIf(test, &HFF&, &H8000&) 'rouge, vert
End With
a = Array(2, 4, 6, 8, 10, 12, 18) 'position des lignes
Application.ScreenUpdating = False
Workbooks.Add 'nouveau document
With ActiveWorkbook.Sheets(1)
[Tableau].Copy .[A1]
.Cells.ClearContents
.Cells.Interior.ColorIndex = xlNone
For i = 1 To [Tableau].Rows.Count
If [Tableau].Cells(i, 1) <> "" Then
n = n + 1
[Tableau].Rows(i).Copy .Cells(IIf(test, n, a(n - 1)), 1)
End If
Next
.[A1].Resize([Tableau].Rows.Count, [Tableau].Columns.Count).Copy [Tableau]
ActiveWorkbook.Close False
End With
End Sub