本帖最后由 一把小刀闯天下 于 2018-6-8 12:03 编辑
Option Explicit
Sub test()
Dim i, j, k, arr, m, n, max, pos
arr = Range("a2:q" & Cells(Rows.Count, "a").End(xlUp).Row)
ReDim brr(1 To Rows.Count, 1 To UBound(arr, 2))
ReDim t(8 To UBound(arr, 2))
For i = 1 To UBound(arr, 1)
n = n + 1: max = 0: pos = n
For j = 1 To 7: brr(n, j) = arr(i, j): Next
For j = 8 To UBound(arr, 2)
t(j) = Split(arr(i, j), ";")
If max < UBound(t(j)) Then max = UBound(t(j))
Next
n = n + max - 1
For j = 8 To UBound(arr, 2)
m = 0
For k = 0 To UBound(t(j)): brr(pos + m, j) = t(j)(k): m = m + 1: Next
Next j, i
With [s2]
.Resize(Rows.Count - 1, UBound(brr, 2)).ClearContents
.Resize(n, UBound(brr, 2)) = brr
End With
End Sub
|