Jon Melone
Board Regular
- Joined
- Mar 10, 2008
- Messages
- 109
Hi,
I receive a spreadsheet with autofilter already enabled. My task is to apply a filter and then enter a vlookup formula into the last column of the filtered list. The last step is to set the filter to show all records. I'd like to have macro to do the work for me.
How do I manipulate an existing autofilter with VBA?
This is what I get when recording a macro:
ActiveSheet.Range("$A$1:$Y$28225").AutoFilter Field:=8, Criteria1:="Netted"
But I need the range to be dynamic as the number of rows in the spreadsheet I'm sent changes.
After the list is filtered, I need to use VBA to enter a vlookup formula in cell Y2 (will be visible when the filter is applied), which then needs to be copied-down to the end of the filtered list.
Finally, the filter is set back to show all and I copy-and-paste values on the vlookups.
So, in addtion to activating the filter, how do I fill down using VBA? The macro recorder shows Selection.FillDown, but at the moment, it's now working when I insert it into my own code.
Jon
I receive a spreadsheet with autofilter already enabled. My task is to apply a filter and then enter a vlookup formula into the last column of the filtered list. The last step is to set the filter to show all records. I'd like to have macro to do the work for me.
How do I manipulate an existing autofilter with VBA?
This is what I get when recording a macro:
ActiveSheet.Range("$A$1:$Y$28225").AutoFilter Field:=8, Criteria1:="Netted"
But I need the range to be dynamic as the number of rows in the spreadsheet I'm sent changes.
After the list is filtered, I need to use VBA to enter a vlookup formula in cell Y2 (will be visible when the filter is applied), which then needs to be copied-down to the end of the filtered list.
Finally, the filter is set back to show all and I copy-and-paste values on the vlookups.
So, in addtion to activating the filter, how do I fill down using VBA? The macro recorder shows Selection.FillDown, but at the moment, it's now working when I insert it into my own code.
Jon