Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Getting Summary Data From A large Data of Files in a Directory

I have a large number of files in a Directory that are stored with names
Agent100, Agent102,Agent 105, etc.

In those file names I have rows A:E filled with Data Variable rows for
Every File
ie file name Agent100
A (date) b(agent) C(Sell Value) D(profit)
Those reports run weekly and produce hundreds of subfiles like the one above

What I need is to open those files names and get the summary for every one
of those files and construct a file for a given range that will have

B(Agent) C(SUmmary of All Cell Values in that file) D(Summary of Profit in
that Given File



Thank you
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Getting Summary Data From A large Data of Files in a Directory

See if this code will help. Modify as necessary.


Sub getfiles()

Set fso = CreateObject _
("Scripting.FileSystemObject")
Set folder = _
fso.GetFolder("C:\temp\") <= changge code as needed

If folder.subfolders.Count 0 Then
For Each sf In folder.subfolders
If InStr(sf, "Agent") Then

Set fso1 = CreateObject _
("Scripting.FileSystemObject")
Set folder1 = _
fso1.GetFolder(sf)
If folder1.Files.Count 0 Then
For Each file In folder1.Files

'add code to open each file here.
Next file
End If
End If
Next sf
End If

End Sub


"stratis" wrote:

I have a large number of files in a Directory that are stored with names
Agent100, Agent102,Agent 105, etc.

In those file names I have rows A:E filled with Data Variable rows for
Every File
ie file name Agent100
A (date) b(agent) C(Sell Value) D(profit)
Those reports run weekly and produce hundreds of subfiles like the one above

What I need is to open those files names and get the summary for every one
of those files and construct a file for a given range that will have

B(Agent) C(SUmmary of All Cell Values in that file) D(Summary of Profit in
that Given File



Thank you

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Getting Summary Data From A large Data of Files in a Direct

Thanks joel But it did not resolve the issues.
Each of the file has different lines and I need to open the file get at the
end do a Summary on each file on sales and profits and then get this figure
to a master file.


"Joel" wrote:

See if this code will help. Modify as necessary.


Sub getfiles()

Set fso = CreateObject _
("Scripting.FileSystemObject")
Set folder = _
fso.GetFolder("C:\temp\") <= changge code as needed

If folder.subfolders.Count 0 Then
For Each sf In folder.subfolders
If InStr(sf, "Agent") Then

Set fso1 = CreateObject _
("Scripting.FileSystemObject")
Set folder1 = _
fso1.GetFolder(sf)
If folder1.Files.Count 0 Then
For Each file In folder1.Files

'add code to open each file here.
Next file
End If
End If
Next sf
End If

End Sub


"stratis" wrote:

I have a large number of files in a Directory that are stored with names
Agent100, Agent102,Agent 105, etc.

In those file names I have rows A:E filled with Data Variable rows for
Every File
ie file name Agent100
A (date) b(agent) C(Sell Value) D(profit)
Those reports run weekly and produce hundreds of subfiles like the one above

What I need is to open those files names and get the summary for every one
of those files and construct a file for a given range that will have

B(Agent) C(SUmmary of All Cell Values in that file) D(Summary of Profit in
that Given File



Thank you

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Getting Summary Data From A large Data of Files in a Direct

The last row of a workshseet can be found using the following code

LastRow = Cells(Rows.Count,"A").End(Xlup).Row

Rows.Count = 65536, it is a VBA constant
xlup will move from the last row of the worksheet to find a data in column
A and stop.

"stratis" wrote:

Thanks joel But it did not resolve the issues.
Each of the file has different lines and I need to open the file get at the
end do a Summary on each file on sales and profits and then get this figure
to a master file.


"Joel" wrote:

See if this code will help. Modify as necessary.


Sub getfiles()

Set fso = CreateObject _
("Scripting.FileSystemObject")
Set folder = _
fso.GetFolder("C:\temp\") <= changge code as needed

If folder.subfolders.Count 0 Then
For Each sf In folder.subfolders
If InStr(sf, "Agent") Then

Set fso1 = CreateObject _
("Scripting.FileSystemObject")
Set folder1 = _
fso1.GetFolder(sf)
If folder1.Files.Count 0 Then
For Each file In folder1.Files

'add code to open each file here.
Next file
End If
End If
Next sf
End If

End Sub


"stratis" wrote:

I have a large number of files in a Directory that are stored with names
Agent100, Agent102,Agent 105, etc.

In those file names I have rows A:E filled with Data Variable rows for
Every File
ie file name Agent100
A (date) b(agent) C(Sell Value) D(profit)
Those reports run weekly and produce hundreds of subfiles like the one above

What I need is to open those files names and get the summary for every one
of those files and construct a file for a given range that will have

B(Agent) C(SUmmary of All Cell Values in that file) D(Summary of Profit in
that Given File



Thank you

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
Extracting data from large text files for beginner [email protected] Excel Worksheet Functions 1 November 12th 08 09:23 AM
importing data from mulitple files in a directory charles Excel Discussion (Misc queries) 1 October 24th 08 02:04 AM
How do I get cell data in multiple Excel files into one summary fi 78degreesinHI Excel Worksheet Functions 4 August 29th 06 02:05 AM
XMLSS/SpreadsheetML or HTML format for large data files mjdenham Excel Programming 0 July 26th 06 12:45 PM
Macro copying info/data in multiple excel files into one summary file. Jskasango Excel Programming 10 April 6th 06 08:27 AM


All times are GMT +1. The time now is 12:21 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"