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!
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!