Re : Probleme avec SpecialCells...
Je vous joins la macro complète au cas ou cela pourrait aider.
Sub Val_Ref()
x = Array("Val1", "Val2", "Val3", "Val4", "Val5", "Val6")
ActiveSheet.Range("$A$1:$AK$1224").AutoFilter Field:=23
ActiveSheet.Range("$A$1:$AK$1224").AutoFilter Field:=23, Criteria1:="Val"
For i = 0 To 5
ActiveSheet.Range("$A$1:$AK$1224").AutoFilter Field:=24, Criteria1:=x(i)
Range("D:G,K:K,L:L,O
,U:U,V:V,X:X,AA:AB,AD:AD,AE:AE,N:N").Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.AutoFilter
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add Key:=Range("K2:K2400") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add Key:=Range("A2:A2400") _
, SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add Key:=Range("D2
2400") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Feuil1").Sort
.SetRange Range("A1:N240")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Cells.Replace What:=Chr(10), Replacement:=" - ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
DeleteRowsThatLookEmptyinColD
Range("B1").Select
ActiveCell.FormulaR1C1 = "Fin"
Range("P1").Select
ActiveCell.FormulaR1C1 = "CA"
ActiveWorkbook.SaveAs Filename:= _
"E:\" & x(i) & ".txt" _
, FileFormat:=xlText, CreateBackup:=False
ActiveWorkbook.Close (True)
ActiveSheet.Range("$A$1:$AL$1221").AutoFilter Field:=24
ActiveSheet.Range("$A$1:$AK$1224").AutoFilter Field:=23
Next
End Sub
Je travaille avec Office 2007 sur les deux ordinateurs. Cependant, lorsque je regarde le numéro de version, celui de mon ordinateur personnel semble plus récent que celui du professionnel. Cela aurait-il un impact quelconque ?