Advanced Filter - exclude headers

后端 未结 1 1427
情书的邮戳
情书的邮戳 2021-01-23 20:58

I have a macro that does an Advanced Filter. How can I exclude the headers from this? I tried changing C:C to C2:C but it\'s not working.



        
相关标签:
1条回答
  • 2021-01-23 21:22

    Unfortunately, no. All of the filter functions work with headers, even the ones where you copy to a new destination, such as in your case. But you can just follow-up with a Delete xlShiftUp to remove the first cell at your destination range and shift everything up a spot:

    Dim r As Range
    
    ' Get the first cell of our destination range...
    Set r = .Cells(.Cells(.Rows.Count, 3).End(xlUp).Row + 1, 3)
    
    ' Perform the unique copy...
    wks.Range("C:C").AdvancedFilter xlFilterCopy, , r, True
    
    ' Remove the first cell at the destination range...
    r.Delete xlShiftUp
    
    0 讨论(0)
提交回复
热议问题