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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| Option Explicit
Sub CollecteInfo()
Dim i As Long
Dim j As Integer
Dim w As Worksheet
Dim a As Long
Application.ScreenUpdating = False
'commencer par néttoyer fiche RECAP qui contient 20 colonnes
With Sheets("data_macro")
a = .Range("A" & Rows.Count).End(xlUp).Row
If .Range("A2") <> "" Then
.Range("A2:T" & a).Select
Selection.ClearContents
End If
End With
'************************
j = 2
For Each w In ThisWorkbook.Worksheets
If w.Name <> "data_macro" Then
For i = 2 To w.[A65000].End(xlUp).Row
If w.Cells(i, 30) <> "" Then
Sheets("data_macro").Cells(j, 1) = w.Cells(i, 2)
Sheets("data_macro").Cells(j, 2) = w.Cells(i, 3)
Sheets("data_macro").Cells(j, 3) = w.Cells(i, 4)
Sheets("data_macro").Cells(j, 4) = w.Cells(i, 5)
'faire même chose pour le reste à savoir : ,F,G,H,I,J,K,L,M,N,O,P,AC,AD,AI,AN,AO
'
'
'
End If
If w.Cells(i, 31) <> "" Then
Sheets("data_macro").Cells(j, 1) = w.Cells(i, 2)
Sheets("data_macro").Cells(j, 2) = w.Cells(i, 3)
Sheets("data_macro").Cells(j, 3) = w.Cells(i, 4)
Sheets("data_macro").Cells(j, 4) = w.Cells(i, 5)
'
'
'
'
' meme chose pour le ligne 3 , la ligne 4 et la ligne 5
j = j + 1
End If
Next i
End If
Next w
Application.ScreenUpdating = True
End Sub |
Partager