PC Review


Reply
Thread Tools Rate Thread

Data from multiple sheets and workbooks

 
 
=?Utf-8?B?THVwdXM=?=
Guest
Posts: n/a
 
      14th Aug 2006
Each week I receive a workbook from one of my customers. It contains mutliple
sheets with salesnumbers from all the branch of my customer. Each sheet
contains from 1 000 to 15 000 lines of salesdata. Every article sold gets one
line in the sheets.

Each workbook are named "weeknr.xls" and are stored in the same folder.

Now my question/problem. I need to gather all sales info for one branch on
one article from all the weeks.

I know how to get the data from one workbook to another, but how do I get it
to scan all the workbooks in the folder.

Any ideas.
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      14th Aug 2006
Dim oFSO

Sub LoopFolders()
Dim Folder As Object
Dim Files As Object
Dim file As Object
Dim fldr

Set oFSO = CreateObject("Scripting.FileSystemObject")

Set Folder = oFSO.GetFolder("c:\MyTest")

For Each fldr In Folder.Subfolders
selectFiles fldr.Path
Next fldr

For Each file In Folder.Files
If file.Type = "Microsoft Excel Worksheet" Then
Workbooks.Open Filename:=file.Path
'now do your stuff
End If
Next file

Set oFSO = Nothing

End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Lupus" <(E-Mail Removed)> wrote in message
news:5564D9B1-4849-4834-9515-(E-Mail Removed)...
> Each week I receive a workbook from one of my customers. It contains

mutliple
> sheets with salesnumbers from all the branch of my customer. Each sheet
> contains from 1 000 to 15 000 lines of salesdata. Every article sold gets

one
> line in the sheets.
>
> Each workbook are named "weeknr.xls" and are stored in the same folder.
>
> Now my question/problem. I need to gather all sales info for one branch on
> one article from all the weeks.
>
> I know how to get the data from one workbook to another, but how do I get

it
> to scan all the workbooks in the folder.
>
> Any ideas.



 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      14th Aug 2006
I want to add this to Bob's reply

If your workbook is used in different language versions you can test for the extension
See http://www.rondebruin.nl/fso.htm

Type = "Microsoft Excel Worksheet" is not working then


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Bob Phillips" <(E-Mail Removed)> wrote in message news:u$(E-Mail Removed)...
> Dim oFSO
>
> Sub LoopFolders()
> Dim Folder As Object
> Dim Files As Object
> Dim file As Object
> Dim fldr
>
> Set oFSO = CreateObject("Scripting.FileSystemObject")
>
> Set Folder = oFSO.GetFolder("c:\MyTest")
>
> For Each fldr In Folder.Subfolders
> selectFiles fldr.Path
> Next fldr
>
> For Each file In Folder.Files
> If file.Type = "Microsoft Excel Worksheet" Then
> Workbooks.Open Filename:=file.Path
> 'now do your stuff
> End If
> Next file
>
> Set oFSO = Nothing
>
> End Sub
>
>
> --
> HTH
>
> Bob Phillips
>
> (replace somewhere in email address with gmail if mailing direct)
>
> "Lupus" <(E-Mail Removed)> wrote in message
> news:5564D9B1-4849-4834-9515-(E-Mail Removed)...
>> Each week I receive a workbook from one of my customers. It contains

> mutliple
>> sheets with salesnumbers from all the branch of my customer. Each sheet
>> contains from 1 000 to 15 000 lines of salesdata. Every article sold gets

> one
>> line in the sheets.
>>
>> Each workbook are named "weeknr.xls" and are stored in the same folder.
>>
>> Now my question/problem. I need to gather all sales info for one branch on
>> one article from all the weeks.
>>
>> I know how to get the data from one workbook to another, but how do I get

> it
>> to scan all the workbooks in the folder.
>>
>> Any ideas.

>
>



 
Reply With Quote
 
=?Utf-8?B?THVwdXM=?=
Guest
Posts: n/a
 
      15th Aug 2006
Thank you both for rapid response. I'm going to try it during the day.

Lupus

"Ron de Bruin" wrote:

> I want to add this to Bob's reply
>
> If your workbook is used in different language versions you can test for the extension
> See http://www.rondebruin.nl/fso.htm
>
> Type = "Microsoft Excel Worksheet" is not working then
>
>
> --
> Regards Ron de Bruin
> http://www.rondebruin.nl
>
>
>
> "Bob Phillips" <(E-Mail Removed)> wrote in message news:u$(E-Mail Removed)...
> > Dim oFSO
> >
> > Sub LoopFolders()
> > Dim Folder As Object
> > Dim Files As Object
> > Dim file As Object
> > Dim fldr
> >
> > Set oFSO = CreateObject("Scripting.FileSystemObject")
> >
> > Set Folder = oFSO.GetFolder("c:\MyTest")
> >
> > For Each fldr In Folder.Subfolders
> > selectFiles fldr.Path
> > Next fldr
> >
> > For Each file In Folder.Files
> > If file.Type = "Microsoft Excel Worksheet" Then
> > Workbooks.Open Filename:=file.Path
> > 'now do your stuff
> > End If
> > Next file
> >
> > Set oFSO = Nothing
> >
> > End Sub
> >
> >
> > --
> > HTH
> >
> > Bob Phillips
> >
> > (replace somewhere in email address with gmail if mailing direct)
> >
> > "Lupus" <(E-Mail Removed)> wrote in message
> > news:5564D9B1-4849-4834-9515-(E-Mail Removed)...
> >> Each week I receive a workbook from one of my customers. It contains

> > mutliple
> >> sheets with salesnumbers from all the branch of my customer. Each sheet
> >> contains from 1 000 to 15 000 lines of salesdata. Every article sold gets

> > one
> >> line in the sheets.
> >>
> >> Each workbook are named "weeknr.xls" and are stored in the same folder.
> >>
> >> Now my question/problem. I need to gather all sales info for one branch on
> >> one article from all the weeks.
> >>
> >> I know how to get the data from one workbook to another, but how do I get

> > it
> >> to scan all the workbooks in the folder.
> >>
> >> Any ideas.

> >
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy multiple sheets to seperate workbooks MY Microsoft Excel Misc 1 15th Oct 2008 07:23 PM
multiple workbooks to sheets =?Utf-8?B?dGhvbWFzRHJldw==?= Microsoft Excel Programming 2 17th May 2007 12:16 AM
HELP TO COMBINE MULTIPLE SHEETS IN MULTIPLE WORKBOOKS =?Utf-8?B?RWRkeSBTdGFu?= Microsoft Excel Programming 12 13th Mar 2006 12:46 PM
combo box multiple workbooks / sheets tcnolan@optonline.net Microsoft Excel Programming 3 6th Nov 2005 09:56 PM
Activating sheets with same name in multiple workbooks =?Utf-8?B?QmFyYiBSZWluaGFyZHQ=?= Microsoft Excel Programming 4 26th Jul 2005 05:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:15 AM.