From the course: Excel VBA: Managing Files and Data

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Chain criteria using AND

Chain criteria using AND - Microsoft Excel Tutorial

From the course: Excel VBA: Managing Files and Data

Start my 1-month free trial

Chain criteria using AND

- [Narrator] In the previous movie, I showed you how to use VBA to create a filter based on a single field. In this movie, I will show you the same technique to filter a list based on values in two or more fields. My sample file is 0103 multiple fields. And that is a macro enabled workbook that you can find in the chapter one folder of the exercise files collection. I have a data list that shows yearly sales for 2019 and 2020 for a variety of states. My goal is to create a filter that will limit the values displayed in this list based on year and state, so two separate columns. To move to the visual basic editor, I'll press Alt + F11, and here I have a code module. And rather than make you type everything out, I have already put in the code for you. So you can use this as a base for your own work. What this code does is first, it defines a variable, string address as a string. Then on the next line, it assigns the…

Contents