ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Code - Excel & Access (https://www.excelbanter.com/excel-programming/414656-vba-code-excel-access.html)

Workbook

VBA Code - Excel & Access
 
I am trying to create a code in an Excel workbook that when I run the macro
it will perform the following functions in the following sequence.

1. Open an Access Database called Asset
2. Copy each record (126 total) from the table called Product Information
3. Create a new worksheet for each record and paste the contents in cells
B2:B11


FSt1

VBA Code - Excel & Access
 
hi
see this site. you may have to modify some.
http://www.vbaexpress.com/kb/getarticle.php?kb_id=889

regards
FSt1

"Workbook" wrote:

I am trying to create a code in an Excel workbook that when I run the macro
it will perform the following functions in the following sequence.

1. Open an Access Database called Asset
2. Copy each record (126 total) from the table called Product Information
3. Create a new worksheet for each record and paste the contents in cells
B2:B11


joel

VBA Code - Excel & Access
 
What I rec ommmend is to get everything from acess and put the data into one
worksheet and then split the sheet into 126 new worksheets.

To get the data from Access I would record a macro while doing the operation
manually. Then modify the recorded Macro as required.

1) To Record Macro from worksheet menu - Tools - Macro - Record new Macro
2) Get data from Access use worksheet menu - Data - Import External Data -
New Data Base Query - MS Access database - Press Ok. Then select file and
Press OK. Select options as required.


After you get the code you can post the code so it can be modified. Each
record should be one row on the spreadsheet so it will be easy to create a
new worksheet for each row. The macro can be written to format and move the
data as required.

"Workbook" wrote:

I am trying to create a code in an Excel workbook that when I run the macro
it will perform the following functions in the following sequence.

1. Open an Access Database called Asset
2. Copy each record (126 total) from the table called Product Information
3. Create a new worksheet for each record and paste the contents in cells
B2:B11



All times are GMT +1. The time now is 11:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com