#1   Report Post  
Posted to microsoft.public.excel.misc
DJN
 
Posts: n/a
Default Multiple Excel Files

I'm looking for a means (probably macro) to condense information from several
spreadsheets onto one. My company has timecards for each employee in excel
files - one for each employee. I need to produce a report for each week,
with each person and charge number. The spreadsheet has a sheet for each
week.

Is there any easy way to do this?
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jed
 
Posts: n/a
Default Multiple Excel Files

Macro to copy multiple worksheets into single work sheet.

Insert a worksheet named MASTER (Name must be in uppercase & must be last
worksheet of the workbook)

Press Alt-F11
Paste following Code there

Public Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function

Sub test()
Dim sh As Worksheet
Dim last As Long
Dim rng As Range
Dim shLast As Long
Worksheets("Master").Cells.ClearContents
Worksheets("Master").Range("a1").Value = "All sheets"
For Each sh In ThisWorkbook.Worksheets
If UCase(sh.Name) < "MASTER" Then
last = LastRow(Worksheets("Master"))
shLast = LastRow(sh)
Set rng = Worksheets("Master").Cells(last + 1, 1)
sh.Range(sh.Rows(1), sh.Rows(shLast)).Copy Destination:=rng
End If
Next
End Sub

Then Press Alt-Q to go back to Excel
( Alt-F8) & Run macro test
All worksheets will be copied into MASTER worksheet.

Hope this helps
Regards
Jed






"DJN" wrote in message
...
I'm looking for a means (probably macro) to condense information from

several
spreadsheets onto one. My company has timecards for each employee in

excel
files - one for each employee. I need to produce a report for each week,
with each person and charge number. The spreadsheet has a sheet for each
week.

Is there any easy way to do this?



  #3   Report Post  
Posted to microsoft.public.excel.misc
DJN
 
Posts: n/a
Default Multiple Excel Files

Is it possible to edit the marco to only copy a certain sheet, say labeled
with the week (i.e. Week(25))?

-DJN

"Jed" wrote:

Macro to copy multiple worksheets into single work sheet.

Insert a worksheet named MASTER (Name must be in uppercase & must be last
worksheet of the workbook)

Press Alt-F11
Paste following Code there

Public Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function

Sub test()
Dim sh As Worksheet
Dim last As Long
Dim rng As Range
Dim shLast As Long
Worksheets("Master").Cells.ClearContents
Worksheets("Master").Range("a1").Value = "All sheets"
For Each sh In ThisWorkbook.Worksheets
If UCase(sh.Name) < "MASTER" Then
last = LastRow(Worksheets("Master"))
shLast = LastRow(sh)
Set rng = Worksheets("Master").Cells(last + 1, 1)
sh.Range(sh.Rows(1), sh.Rows(shLast)).Copy Destination:=rng
End If
Next
End Sub

Then Press Alt-Q to go back to Excel
( Alt-F8) & Run macro test
All worksheets will be copied into MASTER worksheet.

Hope this helps
Regards
Jed






"DJN" wrote in message
...
I'm looking for a means (probably macro) to condense information from

several
spreadsheets onto one. My company has timecards for each employee in

excel
files - one for each employee. I need to produce a report for each week,
with each person and charge number. The spreadsheet has a sheet for each
week.

Is there any easy way to do this?




  #4   Report Post  
Posted to microsoft.public.excel.misc
Jed
 
Posts: n/a
Default Multiple Excel Files

If you want to copy a single worksheet to a new workbook then do the
following:
Select the worksheet you want to copy
From the menubar select Edit
Click in box ( Place a tick) Create A Copy
In Dropdown List in To-book, select (new book) & click OK
A new copy of the work sheet will be created

Hope this helps
Jed




"DJN" wrote in message
...
Is it possible to edit the marco to only copy a certain sheet, say labeled
with the week (i.e. Week(25))?

-DJN

"Jed" wrote:

Macro to copy multiple worksheets into single work sheet.

Insert a worksheet named MASTER (Name must be in uppercase & must be

last
worksheet of the workbook)

Press Alt-F11
Paste following Code there

Public Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function

Sub test()
Dim sh As Worksheet
Dim last As Long
Dim rng As Range
Dim shLast As Long
Worksheets("Master").Cells.ClearContents
Worksheets("Master").Range("a1").Value = "All sheets"
For Each sh In ThisWorkbook.Worksheets
If UCase(sh.Name) < "MASTER" Then
last = LastRow(Worksheets("Master"))
shLast = LastRow(sh)
Set rng = Worksheets("Master").Cells(last + 1, 1)
sh.Range(sh.Rows(1), sh.Rows(shLast)).Copy Destination:=rng
End If
Next
End Sub

Then Press Alt-Q to go back to Excel
( Alt-F8) & Run macro test
All worksheets will be copied into MASTER worksheet.

Hope this helps
Regards
Jed






"DJN" wrote in message
...
I'm looking for a means (probably macro) to condense information from

several
spreadsheets onto one. My company has timecards for each employee in

excel
files - one for each employee. I need to produce a report for each

week,
with each person and charge number. The spreadsheet has a sheet for

each
week.

Is there any easy way to do this?






  #5   Report Post  
Posted to microsoft.public.excel.misc
DJN
 
Posts: n/a
Default Multiple Excel Files

Jed,
thanks for your help, but I was looking for a macro that could extract
Week(25) (for example) from all the spreadsheets. Each employee has a
week(25) sheet in their file.
DJN

"Jed" wrote:

If you want to copy a single worksheet to a new workbook then do the
following:
Select the worksheet you want to copy
From the menubar select Edit
Click in box ( Place a tick) Create A Copy
In Dropdown List in To-book, select (new book) & click OK
A new copy of the work sheet will be created

Hope this helps
Jed




"DJN" wrote in message
...
Is it possible to edit the marco to only copy a certain sheet, say labeled
with the week (i.e. Week(25))?

-DJN

"Jed" wrote:

Macro to copy multiple worksheets into single work sheet.

Insert a worksheet named MASTER (Name must be in uppercase & must be

last
worksheet of the workbook)

Press Alt-F11
Paste following Code there

Public Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function

Sub test()
Dim sh As Worksheet
Dim last As Long
Dim rng As Range
Dim shLast As Long
Worksheets("Master").Cells.ClearContents
Worksheets("Master").Range("a1").Value = "All sheets"
For Each sh In ThisWorkbook.Worksheets
If UCase(sh.Name) < "MASTER" Then
last = LastRow(Worksheets("Master"))
shLast = LastRow(sh)
Set rng = Worksheets("Master").Cells(last + 1, 1)
sh.Range(sh.Rows(1), sh.Rows(shLast)).Copy Destination:=rng
End If
Next
End Sub

Then Press Alt-Q to go back to Excel
( Alt-F8) & Run macro test
All worksheets will be copied into MASTER worksheet.

Hope this helps
Regards
Jed






"DJN" wrote in message
...
I'm looking for a means (probably macro) to condense information from
several
spreadsheets onto one. My company has timecards for each employee in
excel
files - one for each employee. I need to produce a report for each

week,
with each person and charge number. The spreadsheet has a sheet for

each
week.

Is there any easy way to do this?






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
Importing from multiple Excel files Tired of wasting time Excel Discussion (Misc queries) 2 September 21st 05 08:22 PM
sharing/using/saving Excel 2002 files in Excel 2003 maze2009 Excel Discussion (Misc queries) 0 January 20th 05 07:27 PM
how to combine multiple files in ms excel fifi Excel Discussion (Misc queries) 1 January 12th 05 11:11 AM
importing multiple text files??? tashayu Excel Discussion (Misc queries) 0 December 19th 04 02:43 PM
Combine multiple Excel files into one master [email protected] Excel Discussion (Misc queries) 1 November 26th 04 11:20 PM


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