|
参与一下。。。
- Sub ykcbf() '//2024.4.7
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- p = ThisWorkbook.Path
- Set sh = ThisWorkbook.Sheets("Sheet1")
- f = p & "\2.xlsx"
- Set wb = Workbooks.Open(f, 0)
- With wb.Sheets(1)
- arr = .UsedRange
- wb.Close False
- End With
- For i = 2 To UBound(arr)
- s = arr(i, 1)
- If Not d.exists(s) Then
- d(s) = arr(i, 2)
- Else
- d(s) = IIf(InStr(d(s), arr(i, 2)), d(s), d(s) & "、" & arr(i, 2))
- End If
- Next
- With sh
- r = .Cells(Rows.Count, 1).End(3).Row
- zrr = .[a1].Resize(r, 2)
- For i = 2 To UBound(zrr)
- s = zrr(i, 1)
- If d.exists(s) Then
- zrr(i, 2) = d(s)
- End If
- Next
- .[a1].Resize(r, 2) = zrr
- .[a1].Resize(1, 2).Interior.Color = 49407
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
3
查看全部评分
-
|