Retrieve the fullname of linked workbook

lynxbci

Board Regular
Joined
Sep 22, 2004
Messages
201
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi,
I have written a function that uses vlookup and returns an input value (EVal) if an error is encountered.
I have called the function using a linked spreadsheet as the source. But it does not work, due to the following issue :-

The Table.address is not the full location of the source, it is just $A:$S

How can i ensure i am looking back at the full filename of the source data?

Code:
Function ELOOKUP(Val1 As Variant, Table As Range, ResCol As Integer, TF As Boolean, Eval As Variant)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Function ELOOKUP (Error Lookup)
'Returns chosen error value (Eval) if lookup not matched
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim kls As Variant

kls = Application.VLookup(Val1, Range(Table.Address), ResCol, TF)

If IsError(kls) = False Then
   ELOOKUP = kls
Else
   ELOOKUP = Eval
End If

End Function


thanks
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
How simple i just realised my error

Rich (BB code):
Function ELOOKUP(Val1 As Variant, Table As Range, ResCol As Integer, TF As Boolean, Eval As Variant)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Function ELOOKUP (Error Lookup)
'Returns chosen error value (Eval) if lookup not matched
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim kls As Variant

kls = Application.VLookup(Val1, Table, ResCol, TF)

If IsError(kls) = False Then
   ELOOKUP = kls
Else
   ELOOKUP = Eval
End If

End Function

Solved
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,875
Members
452,949
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top