从特定行开始的VBA自动过滤器 - 显示标准和标题

时间:2014-12-18 12:43:40

标签: vba header autofilter

我在尝试显示标题和条件时遇到问题,似乎它只显示第1行和已过滤的行。我希望第1到第6行始终可见(冻结)。我似乎无法做到这一点,尽管我在下面的代码中指定了过滤器的位置。



Sub New_Filter()
Dim Ar As Variant, rng1 As Range, lrow As Long

Set ws = Workbooks("Copy Of MeasurementDatabase").Worksheets("Measurement Signal List")

lrow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
lcol = ws.Cells(7, ws.Columns.Count).End(xlToLeft).Column


Set rng1 = ws.Range(ws.Cells(7, 1), ws.Cells(lrow, lcol))


Ar = ws.Range("B2:F2").Value
    Application.DisplayAlerts = True
    rng1.AutoFilter Field:=1, Criteria1:=Ar, Operator:=xlFilterValues
        
   
End Sub




0 个答案:

没有答案