How do I extract data from multiple workbooks using VBA

Harrish

New Member
Joined
Oct 29, 2009
Messages
9
Hello,

I am trying to create functions in VBA and I need to extract data from multiple workbooks. For example, is it possible to sum data(numbers) contained in multiple workbooks using VBA? If so, how do I create that function in VBA.

Any suggestions would be much appreciated,
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Harrish,

Welcome to the MrExcel board.

What version of Excel are you using?

What is the full path to the directory/folder of the files?

What is the sheet name in the files?

What is the cell, or range of cells, that you want to extract?

Can we have some screenshots of your Summary worksheet, and one from the multiple workbooks.

Please post a screenshot of your sheet(s), what you have and what you expect to achieve, with Excel Jeanie HTML 4 (contains graphic instructions).
http://www.excel-jeanie-html.de/html/hlp_schnell_en.php

Or, if your file does not contain sensitive information, you can upload it to www.box.net and provide a link to your workbook.
 
Upvote 0
Hello,

I am trying to create functions in VBA and I need to extract data from multiple workbooks. For example, is it possible to sum data(numbers) contained in multiple workbooks using VBA? If so, how do I create that function in VBA.

Any suggestions would be much appreciated,

The steps are:

- Open the file (you can create a list of the file in another worksheet of summary, this is what I do)

- When open the file loop all the worksheet inside the workbook to get the value

- Do not forget to create public variable to cater the sum of the data

- Normally for this operation you have already had specific word that mark the range of the amount of the data you want to capture for example total, subtotals etc.

Hope it help and happy coding :cool:

-sea-
 
Upvote 0
For simplicity, lets say I have 10 workbooks (wkbk1, wkbk2,......wkbk10) and I want to sum the values contained in cell A1 of each workbook. What is the VBA code to create this function? All the workbooks are contained in the same folder (FLDR 1) on the C: drive. I am using excel 2007 and have no experience using VBA. I thought it might be easier and less repetitive if I could create a function in VBA as opposed to using the sum function and linking the workbooks.
 
Upvote 0
Harrish,

What version of Excel are you using? Excel 2007


What is the full path to the directory/folder of the files? C:\FLDR 1


What is the sheet name in the files to copy from?


What is the cell, or range of cells, that you want to extract? A1


How may workbooks are you copying from?


Are the number of workbooks to copy from changing?
 
Last edited:
Upvote 0
Harrish,

Please answer each qustion.

Is there more than one worksheet in each of the workbooks in "C:\FLDR 1"?


What is the worksheet name in each of the workbooks in "C:\FLDR 1"?
 
Upvote 0
There is only one worksheet in each workbook and their names are:
PDP,BDS,EQT,TW,SNO,CYN,CAR,FDN......respectively (wkbkone thru eight). Sorry, I guess I only have eight workbooks.
 
Upvote 0

Forum statistics

Threads
1,216,096
Messages
6,128,809
Members
449,468
Latest member
AGreen17

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