|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- Dim r%, i%
- Dim arr, brr(1 To 10000, 1 To 5)
- Dim ws As Worksheet
- m = 0
- For Each ws In Worksheets
- If InStr(ws.Name, ".") <> 0 Then
- With ws
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:o" & r).Formula
- For j = 1 To UBound(arr, 2)
- arr(1, j) = Replace(arr(1, j), vbLf, "")
- Next
- For i = 2 To UBound(arr)
- For j = 3 To UBound(arr, 2) - 1
- If Len(arr(i, j)) <> 0 Then
- crr = Split(Mid(arr(i, j), 2), "+")
- For k = 0 To UBound(crr)
- m = m + 1
- brr(m, 1) = arr(i, 2)
- brr(m, 2) = arr(i, 1)
- brr(m, 3) = ws.Name
- brr(m, 4) = arr(1, j)
- brr(m, 5) = Val(crr(k))
- Next
- End If
- Next
- Next
- End With
- End If
- Next
- With Worksheets("流水")
- .UsedRange.Offset(1, 0).ClearContents
- .Range("a2").Resize(m, UBound(brr, 2)) = brr
- End With
- End Sub
复制代码 |
|