|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 cui26896 于 2021-1-17 13:35 编辑
Sub test2()
Dim arr, brr, i%, i2%, j%, tit, k
tit = Array("门窗代号", "玻璃宽/L", "玻璃高/H", "数量", "玻璃种类")
ReDim brr(1 To 50000, 1 To 5)
For j = 0 To UBound(tit)
brr(1, j + 1) = tit(j)
Next
k = k + 1
For i2 = 7 To Sheets.Count
With Sheets(i2)
arr = .Range("o38:r43")
For i = 1 To UBound(arr)
If Len(arr(i, 1)) Then
k = k + 1
brr(k, 1) = Sheets(i2).Name
For j = 1 To UBound(arr, 2)
brr(k, j + 1) = arr(i, j)
Next
End If
Next
End With
Next
With Sheets(1)
.Range("a2").Resize(100, 5).ClearContents
.Range("a2").Resize(k, UBound(brr, 2)) = brr
End With
End Sub
|
|