JumboCactuar
Well-known Member
- Joined
- Nov 16, 2016
- Messages
- 788
- Office Version
- 365
- Platform
- Windows
Hi,
unsure how to do this, basically wanting to:
specify a folder
load sheet 1 from every workbook in that folder into current workbook
i can do this with single files using the below script but unsure how to automatically work through files in a folder
appreciate any help
unsure how to do this, basically wanting to:
specify a folder
load sheet 1 from every workbook in that folder into current workbook
i can do this with single files using the below script but unsure how to automatically work through files in a folder
Code:
Sub LoadSheet1()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
Dim FileName As String
Dim WS1 As Worksheet
Dim WS2 As Worksheet
Dim ActiveListWB As Workbook
ChDrive Range("A1").Value
ChDir Range("A2").Value
Set WS1 = ActiveWorkbook.Sheets("Sheet1a")
FileName = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls*),*.xls*", _
Title:="Select Timesheet to Import", _
MultiSelect:=False)
If FileName = "False" Then
Exit Sub
Else
Set ActiveListWB = Workbooks.Open(FileName)
End If
Set WS2 = ActiveListWB.Sheets("Sheet1")
WS2.Range("A1:H5000").Copy WS1.Range("A1")
ActiveWorkbook.Close False
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub
appreciate any help