Sub a()
Dim arr, brr(1 To 1048575, 1 To 8), i, m As Long, tmp1, tmp2, tmp3, j, k, t As Byte
Cells.Replace ",", ","
arr = [a1].CurrentRegion
For i = 2 To UBound(arr)
If Right(arr(i, 1), 1) = "," Then arr(i, 1) = Left(arr(i, 1), Len(arr(i, 1)) - 1)
If Right(arr(i, 2), 1) = "," Then arr(i, 2) = Left(arr(i, 2), Len(arr(i, 2)) - 1)
If Right(arr(i, 3), 1) = "," Then arr(i, 3) = Left(arr(i, 3), Len(arr(i, 3)) - 1)
For j = 0 To UBound(Split(arr(i, 1), ","))
For k = 0 To UBound(Split(arr(i, 2), ","))
For t = 0 To UBound(Split(arr(i, 3), ","))
m = m + 1
tmp1 = Split(arr(i, 1), ",")
tmp2 = Split(arr(i, 2), ",")
tmp3 = Split(arr(i, 3), ",")
brr(m, 1) = tmp1(j)
brr(m, 2) = tmp2(k)
brr(m, 3) = tmp3(t)
brr(m, 4) = arr(i, 4)
brr(m, 5) = arr(i, 5)
brr(m, 6) = arr(i, 6)
brr(m, 7) = arr(i, 7)
brr(m, 8) = arr(i, 8)
Next
Next
Next
Next
Sheet2.Cells.Clear
Sheet2.[a2].Resize(m, 8) = brr
End Sub |