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
| Option Explicit
Public Sub addonglet(nomdecompte As String)
Sheets.Add
With Sheets("base data")
'nomdecompte = .target.Value
ActiveSheet.Name = nomdecompte
End With
End Sub
Sub copiecolle()
Dim i As Long
Sheets.Add
With Sheets("base data")
ActiveSheet.Name = Cells(2, "E").Value
For i = 3 To 5000
If Cells(i - 1, 5).Value = Cells(i, 5).Value Then
With Sheets(Cells(2, "E").Value)
Range(Cells(2, "E"), Cells(2, "W")).Copy Destination:=ActiveSheet.Cells(2, "A")
Range(Cells(i, "E"), Cells(i, "W")).Copy Destination:=ActiveSheet.Cells(i, "A")
Application.CutCopyMode = False
Range(Cells(2, "E"), Cells(2, "W")).Copy
Range(Cells(i, "E"), Cells(i, "W")).Copy
ActiveSheet.Cells(2, "A").PasteSpecial xlPasteColumnWidths
ActiveSheet.Cells(i, "A").PasteSpecial xlPasteColumnWidths
End With
End If
Next i
End With
End Sub |
Partager