Delta Star
Board Regular
- Joined
- Oct 28, 2009
- Messages
- 184
I've found the code below which loops through a directory and copies data from cell K2 into a summary sheet.
I need it to be amended so that cells K2, L7 and G6 are copied into the summary sheet into adjoining cells.
Can anyone help with this?
I need it to be amended so that cells K2, L7 and G6 are copied into the summary sheet into adjoining cells.
Can anyone help with this?
HTML:
Sub RunCodeOnAllXLSFiles()
Dim lCount As Long
Dim wbResults As Workbook
Dim wbCodeBook As Workbook
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
On Error Resume Next
Set wbCodeBook = ThisWorkbook
With Application.FileSearch
.NewSearch
'Change path to suit
.LookIn = "C:\Volumes"
.FileType = msoFileTypeExcelWorkbooks
'.Filename = "Book*.xls"
If .Execute > 0 Then 'Workbooks in folder
For lCount = 1 To .FoundFiles.Count 'Loop through all.
'Open Workbook x and Set a Workbook variable to it
Set wbResults = Workbooks.Open(Filename:=.FoundFiles(lCount), UpdateLinks:=0)
'DO YOUR CODE HERE
wbResults.Worksheets("Volume Data").Range("K2").Copy
wbCodeBook.Worksheets("Sheet1").Range("A" & wbCodeBook.Worksheets("Sheet1").Range("A65536").End(xlUp).Row).Offset(1, 0).PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
wbResults.Close SaveChanges:=False
Next lCount
End If
End With
On Error GoTo 0
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub