For compt = 0 To List1.ListCount - 1
With ActiveWorkbook.Worksheets("Feuil1")
.Cells(LigneExcel, 1) = LigneExcel
.Cells(LigneExcel, 2) = List1.List(compt)
LigneExcel = LigneExcel + 1
End With
Next compt
Molenn
Messages postés797Date d'inscriptionmardi 7 juin 2005StatutMembreDernière intervention23 février 20117 3 nov. 2007 à 00:56
Une solution serait d'ouvrir dans un premier temps ton classeur existant, sans doute avec un code du style :
Appli.Workbooks.open(C:\toto.xls)
Ensuite, dans ton code, remplacer ActiveWorkbook par Workbooks("toto.xls"), un truc de ce genre :
For compt = 0 To List1.ListCount - 1
With Workbooks("toto.xls").Worksheets("Feuil1")
.Cells(LigneExcel, 1) = LigneExcel
.Cells(LigneExcel, 2) = List1.List(compt)
LigneExcel = LigneExcel + 1
End With
Next compt
For compt = 0 To List1.ListCount - 1
With Workbooks("C:\a3_3\creer\a3.xls").Worksheets("Feuil1")
.Cells(LigneExcel, 1) = LigneExcel
.Cells(LigneExcel, 2) = List1.List(compt)
LigneExcel = LigneExcel + 1
End With
Next compt