|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub a()
Dim d As Object
Set d = CreateObject("Scripting.Dictionary")
Dim rng As Range
For Each rng In ActiveSheet.[a2:l15] '数据源,按行提取
If rng <> "" Then d(rng.Value) = d(rng.Value) + 1
Next
Dim i&, j&, k&
[a2:l15].ClearContents
[a2:l15].ClearComments '清除批注
For i = 2 To 15
For j = 1 To 7
If k <= d.Count - 1 Then
Cells(i, j) = d.keys()(k)
Cells(i, j).AddComment '增加,批注
Cells(i, j).Comment.Text "重复次数:" & d(Cells(i, j).Value) '增加,批注内容
k = k + 1
End If
Next
Next
Set d = Nothing
End Sub |
评分
-
1
查看全部评分
-
|