bonjour le forum !
J'ai besoin d'un petit coup de main concernant une macro
j'ai un logiciel qui génère un rapport que j'enregistre au format xls et que je souhaite importer dans un fichier complexe.
le fichier est nommé resultat1 et l'onglet resultat 1
Je suis arrivé jusqu'à là pour l'instant
Sub ImportReport()
Dim sh1 As Excel.Worksheet, sh2 As Excel.Worksheet, sh3 As Excel.Worksheet
Dim wb As Excel.Workbook, shA As Excel.Worksheet
Dim year As String, month As String, day As String, RID As String, name As String, name2 As String
Set sh1 = ThisWorkbook.Worksheets("Set")
Set sh2 = ThisWorkbook.Worksheets("Add Report")
Set sh3 = ThisWorkbook.Worksheets("Extract Report")
name = "resultat 1"
name2 = "resultat1.xls"
Set wb = Workbooks(name2)
Set shA = wb.Worksheets(name)
lastrow = shA.Cells(shA.Rows.Count, 1).End(xlUp).Row
sh2.Range("A1:S" & lastrow).Value = shA.Range("A1:S" & lastrow).Value
wb.Close savechanges:=False
End Sub
mais j'ai une erreur à la ligne
Set wb = Workbooks(name2)
je ne comprend pas pourquoi ?
Des idées ???
Merci par avance de toute aide
J'ai besoin d'un petit coup de main concernant une macro
j'ai un logiciel qui génère un rapport que j'enregistre au format xls et que je souhaite importer dans un fichier complexe.
le fichier est nommé resultat1 et l'onglet resultat 1
Je suis arrivé jusqu'à là pour l'instant
Sub ImportReport()
Dim sh1 As Excel.Worksheet, sh2 As Excel.Worksheet, sh3 As Excel.Worksheet
Dim wb As Excel.Workbook, shA As Excel.Worksheet
Dim year As String, month As String, day As String, RID As String, name As String, name2 As String
Set sh1 = ThisWorkbook.Worksheets("Set")
Set sh2 = ThisWorkbook.Worksheets("Add Report")
Set sh3 = ThisWorkbook.Worksheets("Extract Report")
name = "resultat 1"
name2 = "resultat1.xls"
Set wb = Workbooks(name2)
Set shA = wb.Worksheets(name)
lastrow = shA.Cells(shA.Rows.Count, 1).End(xlUp).Row
sh2.Range("A1:S" & lastrow).Value = shA.Range("A1:S" & lastrow).Value
wb.Close savechanges:=False
End Sub
mais j'ai une erreur à la ligne
Set wb = Workbooks(name2)
je ne comprend pas pourquoi ?
Des idées ???
Merci par avance de toute aide