使过滤器下拉菜单移至标题 - VBA Excel 2016

Make filter dropdown menus move into heading - VBA Excel 2016

向下滚动时,第 1 行应替换标题中的字母,但在我的代码中,它就像普通行一样消失了。 我必须如何更改我的代码才能获得此结果?:

(默认 Excel 2016 CSV 导入)

现有代码:

With ActiveSheet .Range("A1:" & Range("A1").SpecialCells(xlCellTypeLastCell).Address).AutoFilter End With

您想隐藏标题

它在功能区中...查看...显示...标题

vba代码

    ActiveWindow.DisplayHeadings = False

然后拆分并冻结顶行

如果需要代码,请录制动作的宏

这个问题的解决方案是创建 table (Insert -> Tables -> Table) 和 select "My Table has headers"

Guide on support.office.com