Re : Aide VBA : demande d'ouvrir fichier source et fichier cible
Merci Robert, mais ça ne marche toujours pas, regarde : c'est peut etre normal mais bon dans ce cas aide moi à savoir ^ù ça beug ..
Code:
Sub Macro()
Dim marche
Dim n
Dim Fichier As Variant
Dim cs As Workbook
Dim cc As Workbook
Fichier = Application.GetOpenFilename
If Fichier = False Then Exit Sub
Workbooks.Open Fichier
Set cs = ActiveWorkbook
Fichier = Application.GetOpenFilename
If Fichier = False Then Exit Sub
Workbooks.Open Fichier
Set cc = ActiveWorkbook
Workbooks("test macro nico.xls").Activate
Worksheets("test").Select
n = ActiveSheet.Range("B2").CurrentRegion.Count
For i = 1 To n
Workbooks(cs).Activate (c'est à ce moment que ça bug)
Worksheets("EXTRACT").Select
ActiveSheet.Range("B2").CurrentRegion.Select
marche = ActiveCell(i).Value
Workbooks(cs).Activate
Worksheets("EXTRACT").Select
ActiveWindow.SmallScroll ToRight:=13
Selection.AutoFilter Field:=25, Criteria1:=marche
Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.SpecialCells(xlCellTypeVisible).Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Selection.Copy
Windows(cc).Activate
Worksheets(marche).Select
Range("A65536").Select
Selection.End(xlUp).Select
ActiveCell(2, 1).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Next i
End Sub