|
- Sub qs() '2024\09\11
- Dim arr, cl, rw, dic As Object, zd
- Set dic = CreateObject("scripting.dictionary")
- With Sheet1
- rw = .Cells.SpecialCells(xlCellTypeLastCell).Row
- arr = .Range("f12:as" & rw).Value
- ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2))
- For cl = 1 To UBound(arr, 2)
- dic.RemoveAll: m = 0
- For rw = 1 To UBound(arr)
- s = arr(rw, cl)
- If s <> Empty Then
- If Not dic.exists(s) Then
- dic(s) = 0
- Else
- dic(s) = dic(s) + 1
- End If
- End If
- Next
- For Each k In dic.keys
- If dic(k) Then
- m = m + 1
- brr(m, cl) = k
- End If
- Next
- If m > zd Then zd = m
- Next
- .Range("au12").Resize(rw, UBound(arr, 2)).ClearContents
- .Range("au12").Resize(zd, UBound(arr, 2)) = brr
- End With
- Set dic = Nothing
- End Sub
复制代码 |
|