|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("汇总")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- c = .Cells(4, .Columns.Count).End(xlToLeft).Column
- arr = .Range("a5").Resize(r - 4, c)
- For i = 1 To UBound(arr)
- d.RemoveAll
- For j = 2 To UBound(arr, 2)
- If Len(arr(i, j)) <> 0 Then
- xm = Split(arr(i, j), vbLf)
- If xm(1) <> "" Then
- xm1 = Split(xm(0), "/")
- xm2 = Split(xm(1), "/")
- If UBound(xm1) = UBound(xm2) Then
- For k = 0 To UBound(xm1)
- d(Left(xm1(k), 1)) = xm2(k)
- Next
- End If
- End If
- End If
- Next
- For j = 2 To UBound(arr, 2)
- ss = Empty
- If Len(arr(i, j)) <> 0 Then
- xm = Split(arr(i, j), vbLf)
- If xm(1) = "" Then
- xm1 = Split(xm(0), "/")
- For k = 0 To UBound(xm1)
- If d.exists(Left(xm1(k), 1)) Then
- ss = ss & "/" & d(Left(xm1(k), 1))
- End If
- Next
- If ss <> mepty Then
- arr(i, j) = xm(0) & vbLf & Mid(ss, 2)
- End If
- End If
- End If
- Next
-
- Next
- .Range("a5").Resize(r - 4, c) = arr
- End With
- End Sub
复制代码 |
|