Microsoft Office Tutorials and References
In Depth Information
19.3.5 AutoFilter Method
We should mention one source of potential problems with the AutoFill method. Apparently, when
AutoFill is executed, the formula in the source cell is copied, with changes , to other cells.
However, the value of the source cell is also copied, but without changes . Thus, if autocalculation
is off, the formulas in the autofilled cells will be correct but the values will be incorrect. To fix
this, just invoke the Calculate method.
19.3.5 AutoFilter Method
The AutoFilter method has two syntaxes, corresponding to two distinct functions. The syntax:
RangeObject .AutoFilter
simply toggles the display of the AutoFilter drop-down arrows for the columns that are involved
in the range.
The syntax:
RangeObject .AutoFilter( Field , Criteria1 , Operator , Criteria2 )
displays the AutoFilter arrows and filters a list using the AutoFilter feature.
The optional Field parameter is the offset (as an integer, counting from the left) of the field on
which the filter is based (the leftmost field is field one).
The optional Criteria1 parameter is the criteria (as a string). We can use "=" to find blank
fields, or "<>" to find nonblank fields. If this argument is omitted, the criteria is All . If Operator
(see the following example) is set to xlTop10Items , then Criteria1 specifies, as an integer,
the number of items to display (this number need not be equal to 10).
The Operator parameter can be one of the following XlAutoFilterOperator constants:
Enum XlAutoFilterOperator
xlAnd = 1
xlOr = 2
xlTop10Items = 3
xlBottom10Items = 4
xlTop10Percent = 5
xlBottom10Percent = 6
End Enum
If this parameter is set to xlAnd or xlOr , then we must use Criteria1 and Criteria2 to
construct the compound criteria.
To illustrate, consider the worksheet shown in Figure 19-5 .
Figure 19-5. A worksheet before autofiltering
 
Search JabSto ::




Custom Search