Je n'arrive pas à changer l'extension... Je n'ai pas le profil admin pour mon ordi et je suis pas fan de windows :/ J'ai donc zippé le fichier en espérant que cela suffise.
J'ai créé ma macro en utilisant "outils - macro - enregistrer une nouvelle macro" pour commencer, puis j'ai essayé de l'améliorer un peu avec qques trucs et astuces trouvés ici. Voilà mon code complet:
Sub Cleanup()
'
' Cleanup Macro
' Macro recorded 16/01/2009 by Eve-Line Humbert
'
' Keyboard Shortcut: Ctrl+Shift+C
'
Extension = ".xls"
fichier = "gebstr" & Format(Date, "yyyymm") & Extension
Mois = Format(Date, "mmmm")
chemin = "H:\algemeen\Klantenmanagement\Gebiedsoptimalisatie\2009\" & Mois & "\"
' Call Trim
ActiveSheet.UsedRange.Columns.Select
Selection.Find(What:=".", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
Selection.Replace What:=".", Replacement:=",", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells.Select
Cells.EntireColumn.AutoFit
Range("L:L,O:O,W:Z").Select
Selection.NumberFormat = "#,##0 $"
Columns("M:M").Select
Selection.NumberFormat = "0"
Columns("P😛").Select
Selection.NumberFormat = "0%"
Range("S:S,T:T,U:U,V:V").Select
Selection.Insert Shift:=xlToRight
Range("S1").Select
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("S2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/100"
Range("S2").Select
Selection.Copy
Range("S583").Select
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Columns("S:S").Select
Selection.Copy
Range("U1").Select
ActiveSheet.Paste
Range("W1").Select
ActiveSheet.Paste
Range("Y1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("R:R,T:T,V:V,X:X").Select
Selection.Delete Shift:=xlToLeft
Columns("R:U").Select
Selection.NumberFormat = "0%"
Columns("R:U").EntireColumn.AutoFit
Range("A2").Select
ChDir "H:\algemeen\Klantenmanagement\Gebiedsoptimalisatie\2009\rapport"
ActiveWorkbook.SaveAs Filename:=chemin & fichier, FileFormat:=xlNormal
End Sub
Il y a certainement moyen de racourcir tout ça, mais comme je ne connais pas bien VBA je tatone encore. Les colones citées dans le code risque de ne pas tout à fait correspondre car j'en ai effacé qques unes (confidentialité)