1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| Sub Macro2()
'
' Macro2 Macro
' Macro enregistrée le 23/03/2006 par Mannes
'
Dim Valeur
Dim toto As String
'
toto = Dir("C:\PourJean\tarif\*.xls", vbDirectory)
Do While (toto <> "")
Workbooks.Open Filename:="C:\PourJean\tarif\" + toto, UpdateLinks:=0
'nom2 = Left(toto, Len(toto) - 4)
'ActiveWorkbook.SaveAs Filename:= _
'"C:\PourJean\" + nom2 + ".txt", FileFormat:=xlText, _
'CreateBackup:=False
'ActiveWorkbook.Close savechanges:=False
Range("B8").Select
Debug.Print Cells(8, 2).Value
Valeur = Cells(8, 2).Value
Open "C:\PourJean\PRIX_NICO.xls" For Input As #1
Cells.Select
Selection.Replace What:=".", Replacement:=",", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Columns("A:A").Select
Selection.Find(What:=" " & Valeur & " ", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Range("B2011:E2011").Select
Application.CutCopyMode = False
Selection.Copy
Windows("1004_Feuil1.xls").Activate
Range("H8:K8").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Windows("Classeur1.xls").Activate
toto = Dir
Loop
End Sub |
Partager