|
楼主 |
发表于 2012-3-23 15:30
|
显示全部楼层
xiapaogg 发表于 2012-3-22 23:50
香川老师,我有个关于消除重复项及统计个数的问题,您看有时间的话看看,多谢您了!!
由表1得出表2,再 ...
直接VBA方法解决:
1. 高级筛选- Sub Uniqe1()
- [b1].Activate
- Do Until ActiveCell = ""
- Range(ActiveCell, ActiveCell.End(4)).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range(Selection.Offset(0, 9).Resize(1, 1).Address), Unique:=True
- ActiveCell.Offset(0, 1).Activate
- Loop
- End Sub
复制代码 2. VBA字典- Sub Uniqe2()
- arr = [a1].CurrentRegion
- Set d = CreateObject("Scripting.Dictionary")
- For j = 2 To UBound(arr, 2)
- For i = 1 To UBound(arr)
- d(arr(i, j)) = ""
- Next
- k = d.keys
- Cells(1, j + 9).Resize(d.Count) = WorksheetFunction.Transpose(k)
- d.RemoveAll
- Next
- End Sub
复制代码 |
|