Vba Excel从一个封闭的文件中执行vlookup [英] Vba Excel do vlookup from a closed file
本文介绍了Vba Excel从一个封闭的文件中执行vlookup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从一个关闭文件中的vlookup到一个活动的打开文件。封闭文件的路径将作为一个变体提供
I would like to do a vlookup from a close file to an active open file, The path of the closed file will be given as a variant
让我们说 mypath =C:\list\ ....
我不知道是否更好地设置路径或全路径(路径+文件名)
I don't know if it is better to set the path only or the full-path (path+filename)
你可以帮助吗?
推荐答案
您将需要完整的路径。
示例
Option Explicit
Public Sub Example()
Dim Path As String
Path = "C:\Temp\"
With ThisWorkbook.Sheets("Sheet1")
.Range("B1").Formula = "=VLOOKUP(A1,'" & Path & "[Book1.xlsx]Sheet2'!A:J,3,FALSE)"
End With
End Sub
这篇关于Vba Excel从一个封闭的文件中执行vlookup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文