I'm trying to create a master spreadsheet that collates worker timesheets from 100+ workers, onto a single master spreadsheet(pasted to 1 sheet, not to separate sheets).
I've managed to get it to the point(with a jigsaw of borrowed code), where the timesheets do paste in to the one master sheet, however, it is doing so with formulas, resulting in errors everywhere.
Also, I'm using a crude counter to increment count to create a new row number to start the next paste.
Is there a way to change the below to paste values, and to start the next paste from the next blank row?
Public Sub ImportActiveList()
Dim FileNames As Variant
Dim FileName As Variant
Dim masterTS As Worksheet
Dim ActiveTS As Workbook
Dim count As Integer
Set masterTS = ActiveWorkbook.Sheets("Sheet1")
FileNames = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls*),*.xls*", _
Title:="Select Active List to Import", _
MultiSelect:=True)
If VarType(FileNames) = vbBoolean Then
If Not FileNames Then Exit Sub
End If
count = 1
For Each FileName In FileNames
Set ActiveTS = Workbooks.Open(FileName)
ActiveTS.Sheets("Timesheet").UsedRange.Copy masterTS.Range("A" & count)
ActiveTS.Close False
count = count + 100
Next FileName
End Sub
I've managed to get it to the point(with a jigsaw of borrowed code), where the timesheets do paste in to the one master sheet, however, it is doing so with formulas, resulting in errors everywhere.
Also, I'm using a crude counter to increment count to create a new row number to start the next paste.
Is there a way to change the below to paste values, and to start the next paste from the next blank row?
Public Sub ImportActiveList()
Dim FileNames As Variant
Dim FileName As Variant
Dim masterTS As Worksheet
Dim ActiveTS As Workbook
Dim count As Integer
Set masterTS = ActiveWorkbook.Sheets("Sheet1")
FileNames = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls*),*.xls*", _
Title:="Select Active List to Import", _
MultiSelect:=True)
If VarType(FileNames) = vbBoolean Then
If Not FileNames Then Exit Sub
End If
count = 1
For Each FileName In FileNames
Set ActiveTS = Workbooks.Open(FileName)
ActiveTS.Sheets("Timesheet").UsedRange.Copy masterTS.Range("A" & count)
ActiveTS.Close False
count = count + 100
Next FileName
End Sub