Sub ImportDatasFromSource()
Dim plg As Range
Dim wkb As Workbook
'Vérifier si le fichier source est ouvert
On Error Resume Next
Set wkb = Workbooks("FichierSource.xls")
If wkb Is Nothing Then
MsgBox "Le fichier source doit être ouvert" & vbCrLf & "Ouvrez le et relancez la macro", vbExclamation, "ImportDatasFromSource"
GoTo FinImport
End If
On Error GoTo 0
With wkb.Sheets("Feuil1")
Set plg = .Range("B2:F" & .Cells(.Rows.Count, 2).End(xlUp).Row)
If plg.Row < 2 Then
MsgBox "La source n'a pas de données à importer", vbExclamation, "ImportDatasFromSource"
GoTo FinImport
End If
'Pour copier strictement en A1 de Feuil2
plg.Copy Destination:=ThisWorkbook.Sheets("Feuil2").Range("A1")
'Pour copier dans la prochaine ligne libre de la colonne A de Feuil2:
'plg.Copy Destination:=ThisWorkbook.Sheets("Feuil2").Cells(Application.Rows.Count, 1).End(xlUp)(2)
MsgBox plg.Rows.Count & " lignes importées du fichiers source", vbInformation, "ImportDatasFromSource"
End With
FinImport:
End Sub