One may need several types of filters in an Excel sheet to help with VBA programming. An Excel sheet is used to simplify tedious calculations and setting filters are important in the process. This will help in setting a range in Excel by using simple programs in VBA. The main query people have is how to retrieve objects in an object range format. The article below is a small VBA programming lesson on selecting an auto filter and object range in the field of a particular cell in an Excel sheet. Initiate it by starting a macro and end the sub VBA program. The cells must be active and not hidden by filters.
With VBA programming, it is possible to set filters on a sheet:
Selection.AutoFilter Field:=1, Criteria1:="FOO"
The filter displays a certain number of lines based on defined criteria.
How to retrieve these rows in a Range objects?
This should answer your problem:
Sub Macro2 ()
Sun rngSelect As Range
'I assumed that the filters are on line 1
Range ( "A1"). Select
'Selection.AutoFilter Field: = 1, Criteria1: = "FOO"
Selection.AutoFilter Field: = 7 Criteria1: = "* paris *"
'RngSelect = all cells visible (not hidden by the filter)
'Contiguous to the active cell
Set rngSelect = ActiveCell.CurrentRegion.SpecialCells (xlCellTypeVisible)
'Copy the selected area
'Many and varied
Set rngSelect = Nothing
For unlimited offline reading, you can download this article for free in PDF format: