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
| Sub banane()
Dim MotCherche, L, InL, C, InC, OutL
Dim Origine As Worksheet, Destination As Worksheet
Set Origine = Workbooks(1).Sheets(1)
Set Destination = Workbooks(1).Sheets(2)
MotCherche = "1"
Debug.Print Origine.UsedRange.Columns.Count
Debug.Print Origine.UsedRange.Rows.Count
Debug.Print Destination.UsedRange.Columns.Count
Debug.Print Destination.UsedRange.Rows.Count
InL = Origine.Cells.SpecialCells(xlCellTypeLastCell).Row
InC = Origine.Cells.SpecialCells(xlCellTypeLastCell).Column
OutL = Destination.Cells.SpecialCells(xlCellTypeLastCell).Row
For L = 1 To InL
For CC = 30 To 40
If Origine.Cells(L, CC).Value = MotCherché Then
For C = 1 To InC
Destination.Cells(OutL, C).Value = Origine.Cells(L, CC - 1 + C).Value
Next
OutL = OutL + 1
End If
Next
Next
End Sub |
Partager