EXCEL中多个SHEET某列的汇总数据汇总到一个新的SHEET中。如果使用宏代码?
答案:2 悬赏:70 手机版
解决时间 2021-03-09 14:51
- 提问者网友:我一贱你就笑
- 2021-03-08 17:29
EXCEL中多个SHEET某列的汇总数据汇总到一个新的SHEET中。如果使用宏代码?
最佳答案
- 五星知识达人网友:不如潦草
- 2021-03-08 18:11
Sub 合并多工作簿及多工作表()
Dim MyPath As String, MyFile As String, i As Integer
Dim Wb As Workbook, arr
Application.ScreenUpdating = False
MyPath = ThisWorkbook.Path
MyFile = Dir(MyPath & "\*.xls")
Do Until MyFile = ""
If MyFile <> ThisWorkbook.Name Then
Set Wb = Workbooks.Open(MyPath & "\" & MyFile)
For i = 1 To Wb.Worksheets.Count
arr = Sheets(i).UsedRange
ThisWorkbook.Sheets(i).Range("A" & rows.count).End(xlUp).Offset(1).Resize(UBound(arr), UBound(arr, 2)) = arr
Next
Wb.Close
End If
MyFile = Dir
Loop
Application.ScreenUpdating = True
End Sub
Dim MyPath As String, MyFile As String, i As Integer
Dim Wb As Workbook, arr
Application.ScreenUpdating = False
MyPath = ThisWorkbook.Path
MyFile = Dir(MyPath & "\*.xls")
Do Until MyFile = ""
If MyFile <> ThisWorkbook.Name Then
Set Wb = Workbooks.Open(MyPath & "\" & MyFile)
For i = 1 To Wb.Worksheets.Count
arr = Sheets(i).UsedRange
ThisWorkbook.Sheets(i).Range("A" & rows.count).End(xlUp).Offset(1).Resize(UBound(arr), UBound(arr, 2)) = arr
Next
Wb.Close
End If
MyFile = Dir
Loop
Application.ScreenUpdating = True
End Sub
全部回答
- 1楼网友:洎扰庸人
- 2021-03-08 19:15
操作方法如下:
将原表复制若干个表,每个表里删除不需要的列。
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯