Bonjour,

j'ai un classeur que je dois repartir en plusieurs puis les envoyer.
je dois filtrer sur des noms que j'ai mis dans un array.
j'essaye de faire une boucle ensuite mais le filtre ne fonctionne pas sur la partie: Criteria1:=myarray(i)
, le code entier ci dessous:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
Sub filtertest()
Dim myrng As Range
Dim wkb As Workbook
Dim myarray(2) As String
Dim i As Integer
 
myarray(0) = "WCIG"
myarray(1) = "WCIA"
myarray(2) = "WHBP"
 
For i = 0 To 2
Worksheets(1).Range("a1").AutoFilter _
Field:=10, Criteria1:=myarray(i)
Set myrng = ActiveCell.CurrentRegion.SpecialCells(xlCellTypeVisible)
myrng.Copy
Set wkb = Workbooks.Add
ActiveWorkbook.Sheets(1).Paste
wkb.SaveAs Filename:=myarray(i)
wkb.Close
Next i
 
End Sub
une idée??
merci