jakeman
Active Member
- Joined
- Apr 29, 2008
- Messages
- 325
- Office Version
- 365
- Platform
- Windows
I'd like to create a dynamic filter range, preferably without using a named range. That said, here is the VBA code that I have for the filter I created using the Macro Recorder:
Now, where I would need the dynamic range is for the column and row number, which change frequently. Sometimes the data goes to Column DE and sometimes DF or DG, etc. Also, each month I append new data so the rows are always increasing.
I created some code to count the number of columns and rows:
Can I use those variables in the range for the filter?
Code:
ActiveSheet.Range("$A$1:$DE$139").AutoFilter Field:=1, Criteria1:= _
xlFilterLastMonth, Operator:=xlFilterDynamic
Now, where I would need the dynamic range is for the column and row number, which change frequently. Sometimes the data goes to Column DE and sometimes DF or DG, etc. Also, each month I append new data so the rows are always increasing.
I created some code to count the number of columns and rows:
Code:
Dim RangeFind, RangeFind2 as Integer
RangeFind = Range("A1").End(xlToRight).Column
RangeFind2 = Range("A1").End(xlDown).Row
Can I use those variables in the range for the filter?