Bonjour teocho
Public wsOrig As Worksheet
Public wsDest As Worksheet
Public semSelect
Sub Copier()
Dim tabOrig(), tabDest()
Dim cptLig, cptCol
Dim nbrDest
Set wsOrig = Worksheets("feuille-à-copier")
Set wsDest = Worksheets("nouvelle-feuille")
semSelect = wsDest.Cells(3, 2)
With wsOrig
tabOrig = Range(.Cells(1, 1), .Cells(LastRow(wsOrig), LastCol(wsOrig)))
End With
nbrDest = 0
For cptLig = 1 To UBound(tabOrig, 1)
If (tabOrig(cptLig, 10 + semSelect) = "X") Then
nbrDest = nbrDest + 1
ReDim Preserve tabDest(1 To 7, 1 To nbrDest)
For cptCol = 1 To 7
tabDest(cptCol, nbrDest) = tabOrig(cptLig, cptCol)
Next
End If
Next
with wsDest
Range(.Cells(11, 1), .Cells(LastRow(wsDest), LastCol(wsDest))).ClearContents
.Cells(11, 1).Resize(UBound(tabDest, 2), UBound(tabDest, 1)) = Application.Transpose(tabDest)
end with
End Sub
Function LastRow(wsTest As Worksheet) As Long
LastRow = wsTest.Cells(Rows.Count, 1).End(xlUp).Row
End Function
Function LastCol(wsTest As Worksheet) As Long
LastCol = wsTest.Cells(1, Columns.Count).End(xlToLeft).Column
End Function
En supposant que tu indique le n° de semaine dans la cellule B3 dans l'onglet [nouvelle-feuille] de ton fichier en PJ
PS/ J'ai fait le code à la volée, mais si tu as besoin que je le commente... aucun problème !