打开excel以下代码,可以提取其他文件中的表“重量汇总”F520:BV521的数据,其中有选择文件路径的过程,你稍改动也许对你有帮助。。。
Sub 数据提取()
Dim FileName1 As String
Dim FileName As String
Dim FileName2 As String
Dim FileName3 As String
Dim FileName4 As String
FileName1 = Application.ActiveWorkbook.Name
FileName1 = Right(FileName1, Len(FileName1))
FileName = Application.GetOpenFilename(" ( *.xls & *.Steel& *.xlsx),*.xls;*.xls;*.Steel", , " ")
FileName = Right(FileName, Len(FileName))
Windows(FileName1).Activate
Sheets(" Sheet 1").Select
Range("A2").Select
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Workbooks.Open FileName:=FileName
FileName2 = Right(FileName, Len(FileName) - InStrRev(FileName, "\"))
Windows(FileName2).Activate
Sheets("重量汇总").Select
Range("F520:BV521").Select
Selection.Copy
Windows(FileName1).Activate
Sheets(" Sheet 1").Select
Range("B2").Select
ActiveSheet.Paste Link:=True
Range("A2").Select
Range("A2") = FileName2
FileName3 = Left(FileName, Len(FileName) - Len(FileName2))
Range("BS2") = FileName3
Windows(FileName2).Close
End Sub查词典
Dict.cn 海词 - 划词释义
已开启划词设置悬停发音即划即查