Avatar of jonlake
jonlake
Flag for Guernsey asked on

Lookup Value from another workbook using VBA

Hi, as a VBA newbie I'm struggling with this challenge.

I have two spreadsheets, a source spreadsheet containing a table of data and a destination spreadsheet into which I need to have data placed at the press of a button.

I have attached each sheet. In the destination s/sheet the user will type the store number, then click a button. This will then look up the matching record in the source spreadsheet and then copy the average balance value into the destination s/sheet (into the yellow box).

All help gratefully received.
Destination.xlsx
Source.xlsx
Microsoft OfficeMicrosoft ExcelVisual Basic Classic

Avatar of undefined
Last Comment
jonlake

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Tracy

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
StephenJR

Why do you need VBA? You could use a formula like this:

=VLOOKUP(A4,Source.xlsx!$A$2:$D$1999,4,FALSE)
jonlake

ASKER
Thanks, this works very well. As a bonus is it possible to have the lookup operate if the source s/sheet were closed?
jonlake

ASKER
Hi StephenJR, unfortunately the s/sheet cannot contain formulas as it is loaded into our accoutning package and will freak out if it contains code. My plan is to use the code currently assigned to a button as an add-in, operated from a ribbon button.

Thanks to all.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23