|
楼主 |
发表于 2017-7-30 16:09
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
按照7楼“”蓝桥玄霜“”给的代码,复制到Sheet2中,提示子过程或函数未定义
本人对这个一点也不懂,你是否可以帮我看一下?感谢
- Sub Macro1()
- Dim arr, d As Object, k, t, i&, n%, aa, j&
- Columns("f:f").Interior.ColorIndex = xlNone
- Set d = CreateObject("scripting.dictionary")
- arr = Range("e4:e" & Range("e65536").End(xlUp).Row)
- For i = 1 To UBound(arr)
- d(arr(i, 1)) = d(arr(i, 1)) & i & ","
- Next i
- k = d.keys: t = d.items: n = 1
- For i = 0 To UBound(k)
- t(i) = Left(t(i), Len(t(i)) - 1)
- If InStr(t(i), ",") Then
- n = n + 1
- aa = Split(t(i), ",")
- For j = 0 To UBound(aa)
- Cella(aa(j) + 3, 6).Interior.ColorIndex = n
- Next
- End If
- Next
- End Sub
复制代码
|
|