|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub 合并数据()
- Dim ws As Worksheet, arr
- Dim i&, j&, p&, rng As Range
- Sheets(1).UsedRange.ClearContents
- Sheets(2).[A1:I2].Copy Sheets(1).[A1]
- For Each ws In Worksheets
- If IsEmpty(ws.[A5]) = False Then
- If ws.Name <> "汇总" Then
- Set rng = ws.[A1:I100].SpecialCells(xlCellTypeConstants, 3)
- arr = rng
- For j = 3 To UBound(arr)
- i = i + 1
- Sheets(1).Cells(i + 2, 1) = i
- For p = 2 To UBound(arr, 2)
- Sheets(1).Cells(i + 2, p) = arr(j, p)
- Next p
- Next j
- End If
- End If
- Next
- End Sub
复制代码
|
|