|
发表于 2014-9-22 12:56
|
显示全部楼层
本楼为最佳答案
- Sub Macro1()
- Dim arr, brr, crr, i&, j&, s&
- arr = Range("a1").CurrentRegion
- brr = Range("c1").CurrentRegion
- ReDim crr(1 To UBound(brr), 1 To 1)
- For i = 2 To UBound(arr)
- s = 1: crr(s, 1) = arr(i, 1)
- For j = 2 To UBound(brr)
- If InStr(brr(j, 1), arr(i, 1)) Then s = s + 1: crr(s, 1) = brr(j, 1): brr(j, 1) = ""
- Next
- If s > 1 Then Cells(1, i + 4).Resize(s) = crr
- Next
- [c1].CurrentRegion = brr
- [c1].Resize(UBound(brr)).SpecialCells(xlCellTypeBlanks).Delete Shift:=xlUp
- End Sub
复制代码 |
|