1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| Sub Copie_Tableau()
Dim Cel As Range, DerCol As Byte, i As Integer, j As Integer
'copie de la feuille 1 après celle-ci
Sheets(1).Copy after:=Sheets(1)
With Sheets(2)
'nom de la nouvelle feuille
.Name = "nom de la nouvelle feuille"
'suppression des deux dernières colonnes
DerCol = .Cells(1, Columns.Count).End(xlToLeft).Column
.Range(.Cells(1, DerCol - 1), .Cells(1, DerCol)).EntireColumn.Delete
'ajout d'un jour pour chaque date de B1 à H1
For Each Cel In .Range("B1:H1")
If IsDate(Cel) Then Cel = Cel + 1
Next Cel
'suppression des lignes vides
For i = .Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
Select Case .Cells(i, 1)
Case Is <= 49, 60 To 70, 80 To 90
For j = 1 To DerCol - 2
If .Cells(i, j) = "" Then
.Rows(i).Delete
Exit For
End If
Next
End Select
Next
End With
End Sub |
Partager