Populating Cells in excel using a combo box in excel from an access table or query.

LUIS FREUND
LUIS FREUND used Ask the Experts™
on
What I'm trying to accomplish is getting data from a table in Access to Excel only populating certain cells within an Excel Sheet by selecting the Supplier Name from a drop down box that user selects.  The Combo Box selection is in the Excel file.

 I have a database called Supplier

 For example: Table Called Supplier.  When the user selects a Supplier name it populates the following:

 Supplier_Name to cell B3
 Supplier_Address to cell B4
 Supplier_City to cell B5
 Supplier_ST to cell C5
 Supplier_Zip to cell B6
 Supplier_POC to cell B9
 Supplier_Phone to cell B12
 Supplier_Fax to cell B15

 The Excel file is called RFQ:  

 See attached files

C--Users-Luis.Freund.EXT-Desktop-E.accdb
C--Users-Luis.Freund.EXT-Desktop-Ex.xlsx
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2017

Commented:
Since the sheet you want to populate is not a "table", then you have to use OLE automation.  That means you need to write VBA code to open Excel and update each cell one at a time.  You can't use TransferSpreadsheet.
Subodh Tiwari (Neeraj)Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015

Commented:
Please find the attached with a drop down in cell B3 on Sheet1.
The code assumes that the database C--Users-Luis.Freund.EXT-Desktop-E.accdb is saved at your desktop.
So once you select a name from the drop down in B3, the code will retrieve the relevant data on the AccessData sheet and the formulas on Sheet1 will return all the data from AccessData sheet.
The third sheet is called List contains a list of suppliers which is used as a source for validation list in B3 on Sheet1.

See if this is what you were trying to achieve.

Note: This is a macro-enabled workbook so you will need to enable the macros while prompted.
C--Users-Luis.Freund.EXT-Desktop-Ex.xlsm

Author

Commented:
AWESOME.......

I added more records to the DB and added the supplier name to sheet3 but on the dropdown box I'm not seeing the new suppliers I added.

any ideas?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Subodh Tiwari (Neeraj)Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015

Commented:
Okay. Please find the attached and just add suppliers names on List sheet starting from A2 and all the names would be visible in the drop down list in B3 on Sheet1.
C--Users-Luis.Freund.EXT-Desktop-Ex.xlsm

Author

Commented:
THIS IS GREAT!   Another quick question....how did you create the combo box and link it to the list?
Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015
Commented:
I created a dynamic named range called "Suppliers" on List Sheet and then used this list as a source for data validation list in B3.
To view the named range, go to Formulas Tab, under Defined Names Group, click on Name Manager and there you will find the named range.
To view the source for the drop down list in B3, select the cell B3 and then go to Data Tab, click on Data Validation and you will find the details for drop down in there.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial