Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
I've Googled to a point where I've onl;y got myself more confused. I couldn't find an answer that I was able to easily relate to, so here I am.
I have a workbook (WM2) with simple data in it. Three columns, the first being dates, the second the sunset time for that date, and the third being the sunset offset time (sunset - 30 minutes).
In my application, I need to get the value of both the sunset (sunset) and sunset offset (sunsetoffset) times of the date being worked with (inq_date) in my application (WB1)
Is there a way I can use an application.worksheetfunction.vlookup statement in my code referencing the data in the closed workbook (WB2) without having to open it?
for example, where workbooks("WB1") is closed.
I have a workbook (WM2) with simple data in it. Three columns, the first being dates, the second the sunset time for that date, and the third being the sunset offset time (sunset - 30 minutes).
In my application, I need to get the value of both the sunset (sunset) and sunset offset (sunsetoffset) times of the date being worked with (inq_date) in my application (WB1)
Is there a way I can use an application.worksheetfunction.vlookup statement in my code referencing the data in the closed workbook (WB2) without having to open it?
for example, where workbooks("WB1") is closed.
VBA Code:
sunset = application.worksheetfunction.vlookup(inq_date,workbooks("WB1").worksheets("Sheet 1").range("A:C"),2,false)
sunsetoffset = application.worksheetfunction.vlookup(inq_date,workbooks("WB1").worksheets("Sheet 1").range("A:C"),3,false)