Je souhaite copier N lignes d'un fichier source vers un fichier cible. Ci-dessous la macro faite mais elle ne marche pas. Pouvez vous trouver l'erreur?
Sub Liste()
Dim strMessage As String
Dim i As Long
Dim ligne As Integer
Dim lignestr As String
Dim lignestrsource As String
Dim Datacible As String
Dim Datasource As String
Dim nomfichiersource As String
Dim nomfichiercible As String
'fichier source = rapport BBH
Set Wbk1 = Workbooks.Open(Filename:=moncheminsource)
nomfichiersource = ActiveWorkbook.Name
'On compte le nombre de ligne dans le fichier source
Dim S As Double
Dim j As Double
For j = 1 To Cells(65536, 2).End(xlUp).Row
If Not Rows(j).Hidden Then S = S + 1
Next j
'On convertit le nombre de ligne du fichier cible en string et on supprime tous les blancs
lignestrsource = Str(S + 1)
lignestrsource = Trim$(lignestrsource)
'On compte le nombre de ligne dans le fichier cible
Dim R As Double
Dim l As Double
For l = 1 To Cells(65536, 2).End(xlUp).Row
If Not Rows(l).Hidden Then R = R + 1
Next l
'On convertit le nombre de ligne du fichier cible en string et on supprime tous les blancs
lignestr = Str(R + 1)
lignestr = Trim$(lignestr)
'### pour prendre la date du rapport BBH - Sweep out date
Workbooks(nomfichiercible).Sheets("Histo").Range(Datacible1) = Workbooks(nomfichiersource).Sheets("CMSAllocations").Range(Datasource1)
'### pour prendre la date du rapport BBH - Sweep Return date
Workbooks(nomfichiercible).Sheets("Histo").Range(Datacible2) = Workbooks(nomfichiersource).Sheets("CMSAllocations").Range(Datasource2)
'### pour la partie BBH Head Account
'N° de compte chez BBH
Workbooks(nomfichiercible).Sheets("Histo").Range(Datacible3) = Workbooks(nomfichiersource).Sheets("CMSAllocations").Range(Datasource3)
'Nom de compte chez BBH
Workbooks(nomfichiercible).Sheets("Histo").Range(Datacible4) = Workbooks(nomfichiersource).Sheets("CMSAllocations").Range(Datasource4)
'CCy du compte
Workbooks(nomfichiercible).Sheets("Histo").Range(Datacible5) = Workbooks(nomfichiersource).Sheets("CMSAllocations").Range(Datasource5)
'### pour la partie Sweep Bank(Parent)
Workbooks(nomfichiercible).Sheets("Histo").Range(Datacible6) = Workbooks(nomfichiersource).Sheets("CMSAllocations").Range(Datasource6)
'### pour la partie Sweep Bank(Branch)
Workbooks(nomfichiercible).Sheets("Histo").Range(Datacible7) = Workbooks(nomfichiersource).Sheets("CMSAllocations").Range(Datasource7)
'### Pour la partie Nb jours Int
Workbooks(nomfichiercible).Sheets("Histo").Range(Datacible8) = Workbooks(nomfichiersource).Sheets("CMSAllocations").Range(Datasource8)
'### Pour la partie Local Sweep Amt
Workbooks(nomfichiercible).Sheets("Histo").Range(Datacible9) = Workbooks(nomfichiersource).Sheets("CMSAllocations").Range(Datasource9)
'### Pour la partie USD Equiv Sweep Amt
Workbooks(nomfichiercible).Sheets("Histo").Range(Datacible10) = Workbooks(nomfichiersource).Sheets("CMSAllocations").Range(Datasource10)
'### Pour la partie Interest Rate
Workbooks(nomfichiercible).Sheets("Histo").Range(Datacible11) = Workbooks(nomfichiersource).Sheets("CMSAllocations").Range(Datasource11)
'### Pour la partie Local Interest Earned Amt
Workbooks(nomfichiercible).Sheets("Histo").Range(Datacible12) = Workbooks(nomfichiersource).Sheets("CMSAllocations").Range(Datasource12)