Consolidation of timesheets required

J Josh

New Member
Joined
Apr 20, 2018
Messages
4
Hello,

I am having many timesheets say around 60 in H:\JJ\Charge Out\Mar 2018\Individual TS - with same format. Every individual is sending me Time sheets with naming convention as their name Eg. Adithya TS , Ravi TS, Megha TS etc. I need to consolidate the data from those sheets to one sheet say "Compilation TS".
Please note each Time sheet is having same format. Please find the time sheet format below
[TABLE="width: 1228"]
<colgroup><col><col><col><col><col span="2"><col><col span="3"></colgroup><tbody>[TR]
[TD]Site[/TD]
[TD]Discipline[/TD]
[TD]Project Number [/TD]
[TD]SRF No.[/TD]
[TD]Project Title[/TD]
[TD]Employee name[/TD]
[TD]Stage[/TD]
[TD]Budgeted[/TD]
[TD]Non-Budgeted[/TD]
[TD]Total[/TD]
[/TR]
[TR]
[TD]GES[/TD]
[TD] NA[/TD]
[TD] 124[/TD]
[TD] NA[/TD]
[TD]KPI Reports [/TD]
[TD]Adithya[/TD]
[TD]E[/TD]
[TD] - [/TD]
[TD] - [/TD]
[TD] - [/TD]
[/TR]
[TR]
[TD]GES[/TD]
[TD] NA [/TD]
[TD] 155[/TD]
[TD] NA[/TD]
[TD]GES-Technical Network[/TD]
[TD]Adithya[/TD]
[TD]E[/TD]
[TD] - [/TD]
[TD] - [/TD]
[TD] - [/TD]
[/TR]
</tbody>[/TABLE]
Now in the Individual TS there are many project numbers say 200 amongst which each individual will charge only on 4 to 5 projects. So the Total column will contain numbers only in few rows (project numbers each individual will charge on).

I want to consolidate all the Time sheets - i want to pull all data from multiple workbooks to one workbooks that too in one sheet.
Can anyone help me?
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
This macro assumes that the timesheets in your folder are the only files in that folder and that they all have an "xlsx" extension.
Code:
Sub CopyRange()
    Application.ScreenUpdating = False
    Dim wsDest As Worksheet
    Set wsDest = ThisWorkbook.Sheets("Compilation TS")
    Dim wkbSource As Workbook
    Dim LastRow As Long
    Dim ws As Worksheet
    Const strPath As String = "H:\JJ\Charge Out\Mar 2018\Individual TS\"
    ChDir strPath
    strExtension = Dir(strPath & "*.xlsx")
    Do While strExtension <> ""
        Set wkbSource = Workbooks.Open(strPath & strExtension)
        With wkbSource
            For Each ws In .Sheets
                If ws.Name Like "*TS*" Then
                    LastRow = ws.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
                    ws.Range("A1:J" & LastRow).AutoFilter Field:=10, Criteria1:="<>"
                    ws.Range("A2:J" & LastRow).SpecialCells(xlCellTypeVisible).EntireRow.Copy wsDest.Cells(wsDest.Rows.Count, "A").End(xlUp).Offset(1, 0)
                    Exit For
                End If
            Next ws
            .Close savechanges:=False
        End With
        strExtension = Dir
    Loop
    Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0
hello,

Set wsDest = ThisWorkbook.Sheets("Compilation TS") - I am getting an error in this..once i click on debug..this line is yellow highlighted but i have saved the excel file as Compilation TS only and this workbook is Macro enabled.
 
Upvote 0
Do you have a sheet named "Compilation TS" in your destination workbook?
 
Upvote 0
hi
Do you want to say - i must have Compilation TS in the given path only i.e H:\JJ\Charge Out\Mar 2018\Individual TS\
 
Upvote 0
In you original post you said:
H:\JJ\Charge Out\Mar 2018\Individual TS
This tells me that your source files are saved in a folder named "Individual TS". You also said:
I need to consolidate the data from those sheets to one sheet say "Compilation TS".
This tells me that you have a worksheet named "Individual TS" in your destination workbook. This is the sheet to which the data will be copied. If you don't have a worksheet named "Individual TS" in your destination workbook, the macro will generate an error.
 
Upvote 0
The path "H:\JJ\Charge Out\Mar 2018\Individual TS" has individual TS i.e Akash TS, Ajay TS and all. Please note Individual TS is name of the folder in which all TS are saved and Compilation TS is the sheet in which i want to collate the data. this Compilation TS is in located in H:\JJ\Charge Out\Mar 2018\. I hope this clarifies that in Mar 2018 folder Individual TS (folder) and Compilation TS (excel sheet) is located.
 
Upvote 0
Perhaps you might be confusing "Compilation TS" as a workbook name versus "Compilation TS" as a sheet name. It sounds like your workbook is saved under the name "Compilation TS" but does this workbook also have a worksheet in it named "Compilation TS"?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top