|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- With Worksheets("表1")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a3:d" & r)
- End With
- ReDim brr(1 To UBound(arr) * 10, 1 To UBound(arr, 2))
- m = 0
- For i = 1 To UBound(arr)
- If InStr(arr(i, 4), "/") = 0 Then
- m = m + 1
- For j = 1 To UBound(arr, 2)
- brr(m, j) = arr(i, j)
- Next
- Else
- xm = Split(arr(i, 4), "/")
- For k = 0 To UBound(xm)
- m = m + 1
- brr(m, 1) = arr(i, 1)
- brr(m, 2) = arr(i, 2)
- brr(m, 3) = xm(k)
- brr(m, 4) = arr(i, 4)
- Next
- End If
- Next
- With Worksheets("表2")
- .Range("a3:d" & .Rows.Count).Clear
- With .Range("a3").Resize(m, UBound(brr, 2))
- .Value = brr
- .Borders.LineStyle = xlContinuous
- End With
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|