|
'我不太可能用你的方法来解决你的问题,修改你的代码还不如重写
'7楼的代码稍作修改,使用颜色判断是否需要处理,自己修改
Option Explicit
Sub test()
Dim arr, i, dic, t As String
Set dic = CreateObject("scripting.dictionary")
With Sheets("数据")
For i = 3 To .Cells(Rows.Count, "c").End(xlUp).Row
If .Cells(i, "l").Font.Color <> vbRed Then '字体红色不作处理
t = .Cells(i, "c").Value
If dic.exists(t) Then
dic(t) = dic(t) & "," & .Cells(i, "e")
Else
dic(t) = "," & .Cells(i, "e")
End If
End If
Next
End With
With Sheets("sheet1")
.[k:k].ClearContents
For i = 3 To .Cells(Rows.Count, "c").End(xlUp).Row
t = .Cells(i, "c")
If dic.exists(t) Then .Cells(i, "k") = CStr(dic(t))
Next
End With
End Sub |
评分
-
2
查看全部评分
-
|