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
|
Dim LastLig As Long
Dim Wbk As Workbook, aWbk As Workbook
Dim stFichierComp As String
Dim plage As Range
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Cells.ClearContents 'Ici efface d'abord toute ta feuille R-04-09, tu peux adapter à seulement ne certaine zone
stFichierComp = "C:\Documents and Settings\Administrateur\Bureau\FACTURATION.xls" ' !!!!!!à adapter
Set Wbk = ThisWorkbook
Set aWbk = Workbooks.Open(stFichierComp)
With aWbk.Sheets("devis")
Set plage = .Range("A1:C" & .Range("A65536").End(xlUp).Row)
plage.AutoFilter 'pour supprimer les filtres existants
plage.AutoFilter Field:=2, Criteria1:=">200"
plage.AutoFilter Field:=3, Criteria1:="<300"
LastLig = .Range("A65536").End(xlUp).Row
If LastLig > 1 Then .Range("A2:C" & LastLig).SpecialCells(xlCellTypeVisible).Copy Wbk.Sheets("R-04-09").Range("A3") 'Tu ne dis pas où copier
End With
aWbk.Close
Set Wbk = Nothing
Set aWbk = Nothing
Application.DisplayAlerts = False
Application.ScreenUpdating = True |