Re : Je sais que c'est facile mais je trouve pas!!
je pensais justement la meme chose à propos du code...
C'est peut etre plus parlant si je te le montre
Sub compilation2()
'
Dim Chemin As String, i As Long
Chemin = "D:\compilation\oct 08"
Set FS = Application.FileSearch
With FS
.LookIn = Chemin
.Filename = "*.xls"
.SearchSubFolders = True
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
Workbooks.Open (.FoundFiles(i))
' ton code ici ......
Sheets(1).Select
Range("I6000").Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
ActiveCell.Offset(0, -8).Select
Application.GoTo Reference:="RC:R13C18"
Selection.Copy
Windows("macro compilationhouse.xls").Activate
Sheets("feuil1").Select
Range("I6000").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, -8).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Workbooks(2).Activate
ActiveSheet.Range("A1").Copy
ActiveWindow.Close
Next
End If
End With
End Sub
Si j'essaie d'y intégrer tes formules, j'obtiens ce code
Sub compilation3()
Dim Chemin As String, i As Long
Chemin = "D:\compilation\oct 08"
Set FS = Application.FileSearch
With FS
.LookIn = Chemin
.Filename = "*.xls"
.SearchSubFolders = True
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
Workbooks.Open (.FoundFiles(i))
' ton code ici ......
MaVar = ""
For Each X In Sheets
If X.Name = "sauvegarde" Then MaVar = X.Index
Sheets("sauvegarde").Select
Range("I6000").Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
ActiveCell.Offset(0, -8).Select
Application.GoTo Reference:="RC:R13C18"
Selection.Copy
Windows("macro compilationhouse.xls").Activate
Sheets("feuil1").Select
Range("I6000").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, -8).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Workbooks(2).Activate
ActiveSheet.Range("A1").Copy
ActiveWindow.Close
Next
If MaVar <> "" Then Sheets(MaVar).Select Else Sheets(1).Select
Sheets(1).Select
Range("I6000").Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
ActiveCell.Offset(0, -8).Select
Application.GoTo Reference:="RC:R13C18"
Selection.Copy
Windows("macro compilationhouse.xls").Activate
Sheets("feuil1").Select
Range("I6000").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, -8).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Workbooks(2).Activate
ActiveSheet.Range("A1").Copy
ActiveWindow.Close
Next
End If
End With
End Sub
Mais il ne marche pas.....
je dois mal m'y prendre avec ton code!!!!!
Est ce que tu vois mon erreur?????
Merci