awaichufeng 发表于 2013-9-29 22:41
首先感谢上楼的老大,小弟在此谢谢!!
现在如果有个单元格式两个,其他单元格是三个,分成多行后,少数 ... - Sub 宏1()
- Dim arr, brr(1 To 100000, 1 To 5), i&, j&, m&, l&, a, b, c
- arr = Range("A1").CurrentRegion
- On Error Resume Next
- For i = 2 To UBound(arr)
- For j = 3 To 4
- arr(i, j) = Replace(arr(i, j), "", "/")
- Next
- arr(i, 5) = Replace(arr(i, 5), "", "-")
- If InStr(arr(i, 3), "/") > 0 And InStr(arr(i, 4), "/") > 0 Then
- a = Split(arr(i, 3), "/")
- b = Split(arr(i, 4), "/")
- c = Split(arr(i, 5), "-")
- l = IIf(UBound(a) > UBound(b), UBound(a), UBound(b))
- For j = 0 To l
- m = m + 1
- brr(m, 1) = m
- brr(m, 2) = arr(i, 2)
- brr(m, 3) = a(j)
- brr(m, 4) = b(j)
- brr(m, 5) = c(j)
- Next
- End If
- Next
- If m > 0 Then [a2].Resize(m, 5) = brr
- End Sub
复制代码 |