Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 89212

Trying to autofilter in Excel using VBA?

$
0
0

I am working on a project that requires me to be able to filter information easily in Excel. I have created lists using data validation, and I am trying to use VBA code to automatically filter the information when those drop down lists are selected.

Every time I try to run the problem, it says there's an error. It points to this code:

Option Explicit

Sub AdvFilt() 'Excel VBA to run the Advanced Filter.
Dim rng As Range
Set rng = Range("B13", Range("U"& Rows.Count).End(xlUp))

    rng.AdvancedFilter 1, [D4:K6], 0
End Sub

I'm very new to VBA and was using this as a guide: https://www.thesmallman.com/blog/2016/9/15/advanced-filter-a-list-automatically

Not sure what I'm doing wrong.


Viewing all articles
Browse latest Browse all 89212

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>