在VBA中合并列并删除重复项

时间:2019-11-13 18:22:50

标签: excel vba concatenation

使用下面的代码有困难。我正在尝试将数据从单元格B6复制到每个工作表的最后一行,并将其粘贴到摘要表中。然后,我想删除重复项。我搜索了几个论坛,但仍然没有运气。

Sub ConsolidateCustomers()

Dim ws As Worksheet

For Each ws In Sheets

    If ws.Name <> "Detailed Aging Summary" And ws.Name <> "Structuring" Then
    Range("B6", .Cells(Rows.Count, 1).End(xlUp).Row).Copy
        destination=Worksheets("Detailed Aging Summary").Range("B3", .Cells(Rows.Count, 
        1).End(xlUp).Row)

    End If

    With Worksheets("Detailed Aging Summary").Range("B3", .Cells(Rows.Count, 
       1).End(xlUp).Row).RemoveDuplicates
    End With

End Sub

0 个答案:

没有答案