Bonjour,
Voir procédure modifiée en conséquence.
Cdlt.
Option Explicit
Sub CopyToNewWorksheets()
Dim wb As Workbook
Dim ws As Worksheet, wsData As Worksheet, wsNew As Worksheet
Dim lastCol As Long, lastRow As Long, lRow As Long
Dim rng As Range, rng2 As Range
Dim Counter As Long, I As Long
Dim modeCalc As XlCalculation
With Application
modeCalc = .Calculation
.Calculation = xlCalculationManual
.DisplayAlerts = False
.ScreenUpdating = False
End With
Set wb = ActiveWorkbook
Set wsData = wb.Worksheets(1)
lRow = 50
For Each ws In wb.Worksheets
If ws.Name <> wsData.Name Then ws.Delete
Next ws
Application.DisplayAlerts = True
With wsData
lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
lastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
Set rng = .Range(.Cells(1), .Cells(lastCol))
For I = 2 To lastRow Step lRow
Set rng2 = .Cells(I, 1).Resize(lRow, lastCol)
Set wsNew = wb.Worksheets.Add(after:=Worksheets(Worksheets.Count))
Counter = wb.Worksheets.Count - 1
With wsNew
.Name = wsData.Name & "_" & Counter
rng.Copy Destination:=.Cells(1)
rng2.Copy Destination:=.Cells(2, 1)
.Range(.Cells(1), .Cells(lastCol)).EntireColumn.AutoFit
.Range("A1,H1,J1").EntireColumn.Hidden = True
End With
Application.CutCopyMode = False
Next I
End With
wsData.Activate
Application.Calculation = modeCalc
Set rng2 = Nothing: Set rng = Nothing
Set wsNew = Nothing: Set wsData = Nothing
Set wb = Nothing
End Sub