2个回答
展开全部
Sub SelectFile()
Application.DisplayAlerts = False
fil = ThisWorkbook.Name
Filename = Application.GetOpenFilename("Excel 文银模件 ,*.xls;*.xlsx")
If Filename <> False Then
aFile = Split(Filename, "\锋亮缓"键举)
sfilename = aFile(UBound(aFile))
End If
Workbooks.Open (Filename)
Workbooks(sfilename).Sheets(1).Cells.Copy Workbooks(fil).Sheets(1).Cells
Workbooks(sfilename).Close
Application.DisplayAlerts = True
End Sub
Application.DisplayAlerts = False
fil = ThisWorkbook.Name
Filename = Application.GetOpenFilename("Excel 文银模件 ,*.xls;*.xlsx")
If Filename <> False Then
aFile = Split(Filename, "\锋亮缓"键举)
sfilename = aFile(UBound(aFile))
End If
Workbooks.Open (Filename)
Workbooks(sfilename).Sheets(1).Cells.Copy Workbooks(fil).Sheets(1).Cells
Workbooks(sfilename).Close
Application.DisplayAlerts = True
End Sub
更多追问追答
追问
更改文件名字还能用吗?
追答
可以啊,重新选择就行
你可以自己试试嘛
对了,这是默认复制第一个工作表的内容
如果需要复制其他的,更改这条
Workbooks(sfilename).Sheets(1).Cells.Copy Workbooks(fil).Sheets(1).Cells
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询