Where does Excel keeps track of the range of a filtered list

lovallee

Board Regular
Joined
Jul 8, 2002
Messages
220
Hello,

I often build one-table database in Excel. For the purpose of this question and to match the Excel help file text wording, lets call such one-table database "list".

I always include automatic filters in the heading of my lists.

Fact:In order to operate automatic filter correctly, Excel automaticly define the range of the list and seems to save it as an hidden name.

Result: After few manipulations in the list(e.g.: data entry, inserting/deleting rows, etc.), Excel may define a range for the list that includes many empty rows after the actual last entry in the list. In such cases, setting the automatic filter of any field to "empty" will result in Excel hidding many empty rows after the list.

My question: on which basis does Excel determine the range of a filtered list? Is there a way of changing the definition of the range of a filtered list the same way I can change the definition of the range of a name (Insert/Name/Define)?

Thank you

Louis
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi Louis,

The range of an Autofilter is accessible via its Range property. This is a read-only property so you can display its range, but not change it. For example to display the range of an autofilter in VBA:

Debug.Print Worksheets(1).AutoFilter.Range.Address

To change an autofilter range, see the topic "AutoFilter Object" in the VBA helps. There is an example of re-creating a filter with a different range (or criteria, etc.).
 
Upvote 0
Hi,

FWIW:

As far as I know XL create a hidden name that hold the range, "FilterDatabase".

This is valid for AutoFilter and Advanced filter.

Kind regards,
Dennis
 
Upvote 0
Dennis, your "almost" right... missed one little character. For example, I did this in the Inmediate pane:<pre>For each Nm in Names:Debug.Print Nm.Name:Next Nm</pre>After setting up an Autofilter on sheet Sheet1. And this name appeared in there:

Sheet1!_FilterDatabase
then, to corroborate what Dennis just said:<pre>?Names("Sheet1!_FilterDatabase").Visible
False</pre>
I believe you can change / delete this address to adjust the filter list.
 
Upvote 0
Master Juan - Good work :)

Damon - Yes, I agree and would like to add that all hidden names that XL use in different situation should be covered up (Juan - Can I leave this to You?) :wink:

Kind regards,
Dennis
 
Upvote 0

Forum statistics

Threads
1,218,038
Messages
6,140,080
Members
450,260
Latest member
JessiMet

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top