Sure thing,
Instead of copying every cell in the worksheet, it just copies A1 to the last used cell.
This is done without having to select the workbook or worksheet.
You can use the worksheet name instead of the number if you want.
These example codes could become usefull to you in the future
http://www.davesexcel.com/vbacodes.htm#363409847
Sub Weekly_Data2()
Dim Rws As Long, Col As Integer, r As Range
Dim Wb As Workbook, fRng As Range, Wsht As Worksheet
For Each Wb In Workbooks
If Wb.Name Like "Weekly Data" & "*" Then
Set Wsht = Wb.Worksheets(1)
With Wsht
Set r = Range("A1")
Rws = .Cells.Find(What:="*", After:=r, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Col = .Cells.Find(What:="*", After:=r, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
Set fRng = Range(.Cells(1, 1), .Cells(Rws, Col)) ' range A1 to last cell on sheet
fRng.Copy Destination:=Workbooks("My Workbook.xlsm").Worksheets(1).Range("A1")
End With
End If
Next Wb
End Sub
Bookmarks