2016 fo rmac 怎么合并多个excel 文件
答案:1 悬赏:10 手机版
解决时间 2021-11-24 13:31
- 提问者网友:最美的风景
- 2021-11-24 07:46
2016 fo rmac 怎么合并多个excel 文件
最佳答案
- 五星知识达人网友:鸽屿
- 2021-11-24 09:23
这个只能用VBA实现
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Sub 汇总数据()
Dim r&, Filename$, wb As Workbook, sht As Worksheet, fn$
Application.ScreenUpdating = False
Filename = Dir(ThisWorkbook.Path & "\*.xlsx")
Do While Filename <> ""
If Filename <> ThisWorkbook.Name Then
fn = ThisWorkbook.Path & "\" & Filename
'Workbooks.Open (fn)
Set wb = GetObject(fn)
Set sht = wb.Worksheets(1)
sht.Copy after:=ThisWorkbook.Worksheets(Worksheets.Count)
ActiveSheet.Name = sht.Name
wb.Close False
End If
Filename = Dir '取得其他工作簿名称
Loop
Application.ScreenUpdating = True
End Sub
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Sub 汇总数据()
Dim r&, Filename$, wb As Workbook, sht As Worksheet, fn$
Application.ScreenUpdating = False
Filename = Dir(ThisWorkbook.Path & "\*.xlsx")
Do While Filename <> ""
If Filename <> ThisWorkbook.Name Then
fn = ThisWorkbook.Path & "\" & Filename
'Workbooks.Open (fn)
Set wb = GetObject(fn)
Set sht = wb.Worksheets(1)
sht.Copy after:=ThisWorkbook.Worksheets(Worksheets.Count)
ActiveSheet.Name = sht.Name
wb.Close False
End If
Filename = Dir '取得其他工作簿名称
Loop
Application.ScreenUpdating = True
End Sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯