Good morning,
I'm not very familiar with how to add more information to this code than below. It works perfectly fine if I wanted to filter a range based on a single cell's value.
I want to have 4 different cells and have the table filter based on all 4 values at the same time.
Filter column# 4 based on value at F2
then Filter column# 6 based on value at F3
then Filter column# 5 based on value at F4
then Filter column# 7 based on value at F5
Whatever's left is what I want to see on the table.
Also, if any of the values don't exist, I assume the table just goes blank, which is fine. If I want to see all data with no filters at all, is there a way to just set each value at F2, F3, F4, and F5 to "All" for it to show the entire table?
The current code is all I have below and it works fine with just one value, but I don't know how to expand it to include 4 values at the same time.
I'm not very familiar with how to add more information to this code than below. It works perfectly fine if I wanted to filter a range based on a single cell's value.
I want to have 4 different cells and have the table filter based on all 4 values at the same time.
Filter column# 4 based on value at F2
then Filter column# 6 based on value at F3
then Filter column# 5 based on value at F4
then Filter column# 7 based on value at F5
Whatever's left is what I want to see on the table.
Also, if any of the values don't exist, I assume the table just goes blank, which is fine. If I want to see all data with no filters at all, is there a way to just set each value at F2, F3, F4, and F5 to "All" for it to show the entire table?
The current code is all I have below and it works fine with just one value, but I don't know how to expand it to include 4 values at the same time.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$F$2" Then
If Range("F2") = "All" Then
Range("A13").AutoFilter
Else
Range("A13").AutoFilter Field:=4, Criteria1:=Range("F2")
End If
End If
End Sub