Name a range that's been filtered

Trikageon

Board Regular
Joined
Apr 29, 2010
Messages
51
I've been looking everywhere for this answer with no luck, so props to whomever can tackle this!

What I need is the code for naming a range that's been filtered. For example, in my macro I'm telling it to filter like so:

Selection.AutoFilter Field:=2, Criteria1:="320"

Now, what I need to do is name that data to "ThreeTwenty." When recording this macro, visually, it comes out like this:

ActiveWorkbook.Names.Add Name:="ThreeTwenty", RefersToR1C1:= _
"=Data!R85C4:R144C10"

The problem I'm running into here is that the "RefersToR1C1" coordinates will likely change each month, so is there a way for it to determine its own dimensions for that filtered range and/or is there some other cool trick to accomplish the same thing that I'm not currently aware of? Thanks in advance!
 
Do you mean code tags? Just use [ code ] at the start of your code and [ /code ] at the end. Omit the spaces between the square brackets ;)
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,215,398
Messages
6,124,690
Members
449,179
Latest member
kfhw720

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