Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Aggregating data from various file in one.

I have a set of data files with the same format that I would like to
add up in a summary excel file. So for example, I would like to add
all the A1 cells of all the sheet1 worksheets of all data files to cell
A1 of the sheet1 worksheet of the summary file. How can I do it?
Thanks in advance for any help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Aggregating data from various file in one.

do you have a list of data files. Or are all the data files in a single
directory with no other files. Or are they all in a single directory, with
other files, but they all have a common unique element in their name?

sub ProcessWorkbooks()
Dim cell as Range, sPath as String, sName as String
Dim bk as Workbook, v as Variant
set cell = thisworkbook.Worksheets("sheet1").Range("A1")
spath = "C:\Myfiles\"
sname = dir(sPath & "*.xls")
do while sName < ""
set bk = workbook.Open(sPath & sName)
v = bk.worksheets("Sheet1").Range("A1")
bk.close Savechanges:=False
if isnumeric(v) then
cell = cell + v
end if
sName = dir()
Loop
End sub

would be the approach for all the *.xls files in a single directory.

--
Regards,
Tom Ogilvy


"lt" wrote:

I have a set of data files with the same format that I would like to
add up in a summary excel file. So for example, I would like to add
all the A1 cells of all the sheet1 worksheets of all data files to cell
A1 of the sheet1 worksheet of the summary file. How can I do it?
Thanks in advance for any help.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Aggregating data from various file in one.

Thanks so much Tom!

Tom Ogilvy wrote:
do you have a list of data files. Or are all the data files in a single
directory with no other files. Or are they all in a single directory, with
other files, but they all have a common unique element in their name?

sub ProcessWorkbooks()
Dim cell as Range, sPath as String, sName as String
Dim bk as Workbook, v as Variant
set cell = thisworkbook.Worksheets("sheet1").Range("A1")
spath = "C:\Myfiles\"
sname = dir(sPath & "*.xls")
do while sName < ""
set bk = workbook.Open(sPath & sName)
v = bk.worksheets("Sheet1").Range("A1")
bk.close Savechanges:=False
if isnumeric(v) then
cell = cell + v
end if
sName = dir()
Loop
End sub

would be the approach for all the *.xls files in a single directory.

--
Regards,
Tom Ogilvy


"lt" wrote:

I have a set of data files with the same format that I would like to
add up in a summary excel file. So for example, I would like to add
all the A1 cells of all the sheet1 worksheets of all data files to cell
A1 of the sheet1 worksheet of the summary file. How can I do it?
Thanks in advance for any help.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Aggregating data among multiple workbooks Kadco Excel Worksheet Functions 1 May 4th 10 02:52 PM
Aggregating Data in Other Category on Pie Chart Thomas M. Charts and Charting in Excel 2 March 24th 09 11:55 PM
Aggregating data for a chart eab Charts and Charting in Excel 0 February 11th 09 04:56 PM
Aggregating data pilotdata Excel Discussion (Misc queries) 6 November 9th 05 02:28 PM
Aggregating data JVLin Excel Programming 4 March 8th 05 03:09 PM


All times are GMT +1. The time now is 06:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"