我在excel中有2个列表。第一个用于搜索(我想要有dropbox),第二个用于数据。 在第二个列表中,我已经过滤了数据但我现在要做的是从第一个列表中给出的参数进行过滤。
如何在首页上传输过滤器标题?
我想在' Search'上选择品牌。列表和结果将在'行'过滤列表。
答案 0 :(得分:1)
如果没有VBA,我想不出办法做到这一点。当然很想知道是否有办法,所以也许别人可以插手。
那就是说,这是一个小型的VBA程序,可以得到你想要的东西。它的工作原理是根据“搜索”表格中“品牌”下拉框的更改。按照以下步骤实施:
如果使用XL2007或更高版本,请务必将文件另存为.xlsm文件(Excel-Macro Enabled File)。
Private Sub Worksheet_Change(ByVal Target As Range)
Dim wksFilter As Worksheet, wks As Worksheet
Dim rngFilter As Range
'replace "A6" with the cell where the Brand dropdown is
If Target.Address = "$A$6" Then
Set wks = Sheets(Target.Parent.Name)
Set wksFilter = Sheets("Rows")
'may need to adjust the number 1 to match the exact location of your Search Column in the rows sheet
wksFilter.UsedRange.AutoFilter 1, wks.Range(Target.Address)
End If
End Sub