|
发表于 2017-4-21 13:18
|
显示全部楼层
本楼为最佳答案
- Sub tt()
- Dim cel As Range, rng As Range
- Set d = CreateObject("scripting.dictionary")
- Set rng = Selection
- ReDim brr(1 To rng.Cells.Count, 1 To 3)
- For Each cel In rng
- x = cel.Value
- n = n + 1
- brr(n, 1) = x: brr(n, 2) = x: brr(n, 3) = x
- d(x) = ""
- Next
- If d.Count <= 6 Then MsgBox "选择区域中不同数字的个数小于等于6个,不粘贴。": Exit Sub
- For Each cel In ActiveSheet.UsedRange
- If cel.Interior.ColorIndex = 6 Then c = cel.Column: Exit For
- Next
- If Len(c) = 0 Then MsgBox "未找到黄色区域": Exit Sub
-
- r = Cells(65536, c).End(3).Row + 1
- If r < 30 Then r = 30
- Cells(r, c).Resize(n, 3) = brr
- End Sub
复制代码 |
|