如何用VBA使用字典在sheet2中得到去除重复姓名的一列姓名

如何用VBA使用字典在sheet2中得到去除重复姓名的一列姓名??
2025-05-20 00:46:19
推荐回答(1个)
回答1:

dim arr ,i , db
arr = Range("C2:C" & ActiveSheet.UsedRange.Rows.Count)
set db = CreateObject("Scripting.Dictionary")
for i=1 to UBound(arr)
    db(trim(arr(1,1))) = True
next i
Sheets("Sheet2").Cells(1 , 1).Resize(db.Count, 1) = db.Keys