How to Import Specific Excel Cells into Access Form Fields Using VBA
Question details
The user needs to transfer data from individual Excel cells or named ranges directly into Microsoft Access form controls.

- Product
- Microsoft Excel, Microsoft Access
- Device & OS
- not provided
- Scenario
- Automating data entry by pulling specific spreadsheet cell data into a database form instead of importing structured rows.
- Observed behavior
- Standard import tools only support tabular data, requiring the use of VBA Excel Automation to extract individual cell values.
Ensure you have full access to both the source Excel workbook and the destination Access database. You must also enable the Microsoft Excel Object Library in your Access VBA editor references.
Use VBA Excel Automation to Map Cells to Form Controls
Write a VBA script in Microsoft Access to open the Excel workbook, extract the required cell values, and populate your form fields.
Because you are importing individual, scattered cells rather than standard rows of data, traditional import wizards will not work. Excel Automation allows Microsoft Access to control Excel in the background and pull exactly the data you need into the form.
Open your Access database, navigate to your form in Design View, and press Alt + F11 to open the VBA Editor.
In the VBA Editor menu, go to 'Tools' > 'References', scroll down, and check the box for 'Microsoft Excel Object Library', then click OK.
Write VBA code to declare and set your Excel Application, Workbook, and Worksheet objects (e.g., `Set xlApp = CreateObject("Excel.Application")`).
Open the target workbook using `xlApp.Workbooks.Open` and map your Access form text box values to the Excel cell values using code like `Me.txtFieldValue = xlSheet.Range("A1").Value`.
Close the workbook using `xlBook.Close False`, quit the Excel application, and set your variables to `Nothing` to free up system memory.
Looking for a Lightweight and Free Office Suite?
While advanced Access-to-Excel VBA automation is specific to the Microsoft ecosystem, WPS Office provides a powerful, free alternative for your everyday spreadsheet, document, and presentation needs. It is lightweight, fully compatible with standard Office formats, and incredibly easy to use.
- 1. Download the Installer: Visit the official WPS Office website and download the free installation package for your operating system.
- 2. Install WPS Office: Run the downloaded installer and follow the quick on-screen instructions to set up the software.
- 3. Open Your Spreadsheets: Launch WPS Spreadsheets and seamlessly open, edit, and save your existing Excel documents.

Frequently Asked Questions
Can I import named ranges instead of specific cell coordinates?
Yes, in your VBA script, you can reference a named range using `xlSheet.Range("YourNamedRange").Value` instead of using a specific cell coordinate like "A1" or "C4".
Why do I get a 'User-defined type not defined' error when running the code?
This usually happens if you forget to enable the Microsoft Excel Object Library in Access. Open the VBA Editor, click Tools > References, and check the box for the correct Excel library version.
Can I map multiple Excel cells to different Access form fields at the same time?
Absolutely. Once the Excel workbook is opened by the background process, you can write multiple lines of code to map as many specific cells as needed to their corresponding Access form controls before closing the connection.
Is it possible to import individual cells without using VBA?
No, standard import wizards in Microsoft Access only support importing structured, tabular data formatted in rows and columns. To target scattered, individual cells, VBA Excel Automation is required.




