|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub 整理数据()
- Dim brr(), arr, i, j, m, n
- arr = Range("a1").CurrentRegion
- For j = 5 To UBound(arr, 2) - 1 Step 2
- For i = 3 To UBound(arr)
- If arr(i, 1) = "" Then arr(i, 1) = arr(i - 1, 1)
- If arr(i, j) <> "" Then
- n = n + 1
- ReDim Preserve brr(1 To 8, 1 To n)
- brr(1, n) = arr(1, 1)
- For m = 1 To 4
- brr(m + 1, n) = arr(i, m)
- Next m
- brr(6, n) = arr(i, j)
- brr(7, n) = arr(i, 4) * arr(i, j)
- brr(8, n) = arr(1, j)
- End If
- Next i
- Next j
- [l2].Resize(n, 8) = Application.Transpose(brr)
- End Sub
复制代码 |
|