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
| Public Sub FilterObjects(myCat As String, myColumn As Integer, _
myoperator As String, ObjStatus As String, blnCntSum As Boolean)
Dim InputRange As Range, OutputRange As Range
Dim FinalRow As Integer, LastColumn As Integer
'-------------------------------------------
Worksheets("FiltTable").Cells.ClearContents
'Define the global output range ************
'FinalRow a été définie auparavant
Set OutputRange = Worksheets("FiltTable").Range("A1:L" & FinalRow)
'Define the global input range. ************
Set InputRange = WsData.Range("A1:L" & FinalRow)
'Clear the last filter criteria
With Worksheets("Filters")
.Range("criteria1").ClearContents
End With
'Write the new filter criteria into cells B7:B8 on worksheet "Filters"
With Worksheets("Filters")
.Range("B7").Value = WsData.Cells(1, myColumn) '= Catégorie
.Range("B8").Value = myCat '= jardin
End With
'Copy filtered range of database into sheet "FiltTable"
InputRange.AdvancedFilter _
Action:=xlFilterCopy, CriteriaRange:=Worksheets("Filters").Range("Criteria1"), _
copytorange:=OutputRange
Erreur d'exécution 1004. Le nom de champ est incorrect ou manquant dans la zone d'extraction. |