以下是一个 VBA 合并多个 Excel 文件的代码示例:
Sub 合并文件()
Dim 文件目录 As String, 文件名 As String, 文件扩展名 As String
Dim 打开的文件 As Workbook, 目标文件 As Workbook
Dim 目标工作表 As Worksheet, 工作表 As Worksheet
Dim 最后一行 As Long, 目标行 As Long
'设置文件目录
文件目录 = "C:\Users\UserName\Documents\Files\"
'设