Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. Public Sub GetTimesheetData()
  2.  
  3. Dim fsoFileObject As New Scripting.FileSystemObject
  4. Dim employeeTimesheet As File
  5. Dim folderPath As String
  6. Dim nextEmpty As Long
  7.  
  8. folderPath = "C:GatherTimesheets" '<<<<< There are 300 excel timesheets in this folder.
  9.  
  10. For Each employeeTimesheet In fso.folderPath.Files '<<<< Is this correct?
  11.  
  12. If empoyeeTimesheet.Name Like "*.xls" Then
  13. Sheets("Main").Select
  14. With Range("A1:AC51")
  15. .Formula = "='C:GatherTimesheets" & employeeTimesheet '<<<< How to write this formula??
  16. .Value = .Value
  17. End With
  18.  
  19. nextEmpty = Sheets("Results").Range("D65444").End(xlUp).Row + 1
  20.  
  21. Sheets("Main").Range("CS1:DF1").Copy
  22. With Sheets("StagingRaw").Range("D" & nextEmpty)
  23. .PasteSpecial xlValues
  24. Application.CutCopyMode = False
  25. End With
  26. End If
  27.  
  28. Next employeeTimesheet
  29.  
  30. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement