Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Data Compilation Macro

Hi All,

thank you very much for your previous helps.

I have one problem here. I have a folder where i get data in .xls format. I
get nearly hundred files a day. I need to manually sit and cut copy paste all
the data so that i could have all the data on a single excel sheet.

Request you to design a macro for the same.

Many thanks
--
Varun Nair

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Data Compilation Macro

You might need to change the code to get the last cell depending upon your
data structure

Option Explicit


Dim oFSO

Sub LoopFolders()

Set oFSO = CreateObject("Scripting.FileSystemObject")

selectFiles "c:\MyTest"

Set oFSO = Nothing

End Sub


'---------------------------------------------------------------------------
Sub selectFiles(sPath)
'---------------------------------------------------------------------------
Dim Folder As Object
Dim Files As Object
Dim file As Object
Dim fldr

Set Folder = oFSO.GetFolder(sPath)

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
ActiveWorkbook.Worksheets(1).UsedRange.Copy _

ThisWorkbook.Worksheets(1).Range("A1").End(xlDown) .Offset(1,0)
End If
Next file

End Sub

--
HTH

Bob Phillips

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

"Varun Nair" wrote in message
...
Hi All,

thank you very much for your previous helps.

I have one problem here. I have a folder where i get data in .xls format.

I
get nearly hundred files a day. I need to manually sit and cut copy paste

all
the data so that i could have all the data on a single excel sheet.

Request you to design a macro for the same.

Many thanks
--
Varun Nair



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Data Compilation Macro

Hi Bob,

All the files to be compiled are in a single folder. would this macro work
for even such files
--
Varun Nair



"Bob Phillips" wrote:

You might need to change the code to get the last cell depending upon your
data structure

Option Explicit


Dim oFSO

Sub LoopFolders()

Set oFSO = CreateObject("Scripting.FileSystemObject")

selectFiles "c:\MyTest"

Set oFSO = Nothing

End Sub


'---------------------------------------------------------------------------
Sub selectFiles(sPath)
'---------------------------------------------------------------------------
Dim Folder As Object
Dim Files As Object
Dim file As Object
Dim fldr

Set Folder = oFSO.GetFolder(sPath)

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
ActiveWorkbook.Worksheets(1).UsedRange.Copy _

ThisWorkbook.Worksheets(1).Range("A1").End(xlDown) .Offset(1,0)
End If
Next file

End Sub

--
HTH

Bob Phillips

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

"Varun Nair" wrote in message
...
Hi All,

thank you very much for your previous helps.

I have one problem here. I have a folder where i get data in .xls format.

I
get nearly hundred files a day. I need to manually sit and cut copy paste

all
the data so that i could have all the data on a single excel sheet.

Request you to design a macro for the same.

Many thanks
--
Varun Nair




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Data Compilation Macro

This code ONLY works on a single folder.

--
HTH

Bob Phillips

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

"Varun Nair" wrote in message
...
Hi Bob,

All the files to be compiled are in a single folder. would this macro work
for even such files
--
Varun Nair



"Bob Phillips" wrote:

You might need to change the code to get the last cell depending upon

your
data structure

Option Explicit


Dim oFSO

Sub LoopFolders()

Set oFSO = CreateObject("Scripting.FileSystemObject")

selectFiles "c:\MyTest"

Set oFSO = Nothing

End Sub



'---------------------------------------------------------------------------
Sub selectFiles(sPath)

'---------------------------------------------------------------------------
Dim Folder As Object
Dim Files As Object
Dim file As Object
Dim fldr

Set Folder = oFSO.GetFolder(sPath)

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
ActiveWorkbook.Worksheets(1).UsedRange.Copy _

ThisWorkbook.Worksheets(1).Range("A1").End(xlDown) .Offset(1,0)
End If
Next file

End Sub

--
HTH

Bob Phillips

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

"Varun Nair" wrote in message
...
Hi All,

thank you very much for your previous helps.

I have one problem here. I have a folder where i get data in .xls

format.
I
get nearly hundred files a day. I need to manually sit and cut copy

paste
all
the data so that i could have all the data on a single excel sheet.

Request you to design a macro for the same.

Many thanks
--
Varun Nair






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
Project - Forms Data Compilation John Leigh Excel Discussion (Misc queries) 0 September 25th 07 05:44 PM
Data Compilation Macro Varun Nair Excel Programming 1 October 11th 06 02:21 AM
Data compilation within a single workbook Robert Excel Worksheet Functions 0 March 13th 06 11:23 PM
summing up daily data in a monthly compilation mark_vi_ Excel Worksheet Functions 2 June 22nd 05 01:07 AM
EXCEL VBA - Data compilation coming in from an external feed marcus[_2_] Excel Programming 0 January 29th 04 04:14 AM


All times are GMT +1. The time now is 12:33 AM.

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"