Excel VBA to copy unique values duplicate 1st value

后端 未结 2 683
野性不改
野性不改 2021-01-17 06:11

I have this excel VBA code

Sub Module()

Range(\"A1:A10\").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range(\"D1\"), Unique:=True

End Sub


        
相关标签:
2条回答
  • 2021-01-17 06:40

    An alternative approach, which doesn't require a header.

    Sub Module()
    
    Application.ScreenUpdating = False
    
    With Range("A1:A10")
        .Copy .Offset(, 3)
        .Offset(, 3).RemoveDuplicates Columns:=1, Header:=xlNo
    End With
    
    Application.ScreenUpdating = True
    
    End Sub
    
    0 讨论(0)
  • 2021-01-17 06:41

    Insert another cell above cell A1. Write "Header" or any other text in this box. Change the range to A1:A11. This should solve your problem.

    0 讨论(0)
提交回复
热议问题