Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Sub GetTimesheetData()
- Dim fsoFileObject As New Scripting.FileSystemObject
- Dim employeeTimesheet As File
- Dim folderPath As String
- Dim nextEmpty As Long
- folderPath = "C:GatherTimesheets" '<<<<< There are 300 excel timesheets in this folder.
- For Each employeeTimesheet In fso.folderPath.Files '<<<< Is this correct?
- If empoyeeTimesheet.Name Like "*.xls" Then
- Sheets("Main").Select
- With Range("A1:AC51")
- .Formula = "='C:GatherTimesheets" & employeeTimesheet '<<<< How to write this formula??
- .Value = .Value
- End With
- nextEmpty = Sheets("Results").Range("D65444").End(xlUp).Row + 1
- Sheets("Main").Range("CS1:DF1").Copy
- With Sheets("StagingRaw").Range("D" & nextEmpty)
- .PasteSpecial xlValues
- Application.CutCopyMode = False
- End With
- End If
- Next employeeTimesheet
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement