Celly
Board Regular
- Joined
- Jan 29, 2015
- Messages
- 84
- Office Version
- 2016
- Platform
- Windows
I am trying to reference a named range in an AutoFilter like so:
Example 1
No syntax seems to work. I can convert range2 to a string, and that is fine:
Example 2
It really isn't the same thing, it becomes static versus dynamic. I would prefer Example1 for performance and simplicity in refreshing the filter. In other words, this would theoretically refresh changes to Range1:
In Example 2, the AutoFilter has to be regenerated.
Example 1
VBA Code:
[Range1].AutoFilter field:=1, Criteria1:=">='" & ThisWorkbook.Name & "'![Range2]", VisibleDropDown:=False
No syntax seems to work. I can convert range2 to a string, and that is fine:
Example 2
VBA Code:
[Range1].AutoFilter field:=1, Criteria1:=">=" & [Range2], VisibleDropDown:=False
It really isn't the same thing, it becomes static versus dynamic. I would prefer Example1 for performance and simplicity in refreshing the filter. In other words, this would theoretically refresh changes to Range1:
VBA Code:
Sheet1.AutoFilter.ApplyFilter
In Example 2, the AutoFilter has to be regenerated.