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
| Sub VerifierCopier()
Dim Lig As Long
Dim NbrLig As Long
Dim NumLig As Long
Application.ScreenUpdating = False
' néttoyer la feuille 2
Sheets("feuil2").Select
Sheets("feuil2").Cells.ClearContents 'nettoyer feuille 2
Sheets("feuil2").Cells(1, 1).Resize(1, 7) = Array("id", "nom de la revue", "", "issn", "volume", "numero", "année") 'remplir les titres de colonnes
'****************
NumLig = 2
With Sheets("Feuil1") ' feuille source
NbrLig = .Cells(Rows.Count, 1).End(xlUp).Row
For Lig = 1 To NbrLig
If .Cells(Lig, 1).Value <> .Cells(Lig + 1, 1).Value Then
.Cells(Lig, 1).EntireRow.Copy
.Cells(Lig + 1, 1).EntireRow.Copy
Sheets("feuil2").Cells(NumLig, 1).Select
ActiveSheet.Paste
End If
NumLig = Sheets("feuil2").Cells(Rows.Count, 1).End(xlUp).Row + 1
Next
End With
Application.ScreenUpdating = True
End Sub |
Partager