Lookup across two workbooks

Claire Jackson

Board Regular
Joined
Jun 30, 2020
Messages
74
Office Version
  1. 2016
Platform
  1. Windows
Hi,
Im new to all this and have been googling forever on this

I basically have two workbooks, one with data in a another where i want to lookup cell $E$1 and return a value from column 61 (BI) in the other workbook.

The code i have is this:

Option Explicit

Sub Get_CM_Name()

Dim Range_Lookup As Range
Dim ContMan_Name As String
Dim found_value As Variant

ContMan_Name = "$E$1"

'tables.xls must be open
Workbooks.Open ("\\PDDC01\ClaimManagement\0-CLAIRE\Daily Report CRM.xlsx")

Set Range_Lookup _
= Workbooks("Daily Report CRM.xlsx").Worksheets("table").Range("A1:DE1000")

found_value = Application.VLookup(ContMan_Name, Range_Lookup, 61, False)

If IsError(found_value) Then
'n/a would have been returned
Else
'no error
End If

End Sub

What am I doing wrong as it opens the data file but then just sits in cell B8 of the datafile without returning anything to my other workbook. I'm not sure how to point the data which is being looked up back to Cell B4 in my current workbook

Please help?
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
In your code, if the 'found_value' isn't an error you don't do anything with it

VBA Code:
If IsError(found_value) Then
    'n/a would have been returned
Else
    'no error - 
     'so need to add code to fill information in
End If

End Sub
 
Upvote 0
OK i've removed the bit about the error but it still isn't working. ?? Do you have perhaps a working version of pulling from two files that I can copy?
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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