ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vlookup with closed workbook (https://www.excelbanter.com/excel-programming/332239-re-vlookup-closed-workbook.html)

Daniel[_21_]

vlookup with closed workbook
 
Thanks for all.
Daniel
"Dave Peterson" a écrit dans le message de news:
...
Can you use a helper cell in a that worksheet?

If yes, you could plop the formula into that cell and get the value. This
worked ok for me.

Option Explicit
Sub testme02()
Dim HelpCell As Range
Dim myVal As Variant

With ActiveSheet
Set HelpCell = .Cells.SpecialCells(xlCellTypeLastCell).Offset(1, 1)
With HelpCell
.Formula _
= "=VLOOKUP(A1,'C:\My Documents\excel\" _
& "[Book2.xls]Sheet1'!$A:$B,2,FALSE)"
myVal = .Value
.ClearContents
End With
End With

If IsError(myVal) Then
MsgBox "error!"
Else
MsgBox myVal
End If

End Sub



Daniel wrote:

Hello,
The following formula works fine :
=VLOOKUP(A1,'E:\Donnees\Daniel\mpfe\test.xls'!list e,2,FALSE)
Is it possible to do the same with VBA, the test.xls workbook being
closed ?
Thanks in advance.
Daniel


--

Dave Peterson





All times are GMT +1. The time now is 05:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com