J'ai créé une macro, mais elle a inséré le nom de fichier du fichier dans lequel j'étais lorsque je l'ai créée. Je veux l'utiliser pour de nombreux fichiers avec de nombreux noms différents (potentiellement des milliers de fichiers). Comment puis-je rendre la macro indépendante du nom de fichier? sous le nom de fichier "ADP" est utilisé et maintenant cette macro ne fonctionnera pas avec d'autres noms de fichiers, par ex. "CPL" ou "DKH"Excel Maco: comment utiliser un nom de fichier de variable
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
ActiveWorkbook.Worksheets("ADP").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("ADP").Sort.SortFields.Add Key:=Range("A1"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("ADP").Sort
.SetRange Range("A1:G7694")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.SaveAs Filename:="C:\Data\ADP.csv", _
FileFormat:=xlCSV, CreateBackup:=False
ActiveWorkbook.Close