2016 fo rmac 怎么合并多个excel 文件
2016-08-18
展开全部
这个只能用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
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询