Sub Truck1Open()
Dim v, aug1 As Worksheet
Set v = ThisWorkbook.Sheets("Summary")
Dim filepath, f As String
Dim aug As Variant
Dim sn As String
Dim r As Range, myRange As Range
Dim xrow As Long
filepath = v.Cells(2, "K").Value
**********************************************
'This is Outside your loop.
Workbooks.Open (filepath & "\" & aug & ".xlsx")
**********************************************
For Count = 2 To v.UsedRange.Rows.Count
aug = v.Cells(3, "K").Value
sn = v.Cells(Count, "G").Value
**********************************************
'This is inside your loop. So I disabled it.
'Workbooks.Open (filepath & "\" & aug & ".xlsx")
**********************************************
ActiveWorkbook.Worksheets(sn).Activate
With ActiveSheet
Range("B4").Select
Selection.Copy
End With
v.Activate
With ActiveSheet
xrow = v.Cells(v.Rows.Count, 1).End(xlUp).Row + 1
v.Range(v.Cells(xrow, 1), v.Cells(xrow, 1)).Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End With
Workbooks(aug & ".xlsx").Activate
Workbooks(aug & ".xlsx").Worksheets(sn).Select
With ActiveSheet
Range("B8").Select
Selection.Copy
End With
v.Activate
With ActiveSheet
xrow = v.Cells(v.Rows.Count, 2).End(xlUp).Row + 1
v.Range(v.Cells(xrow, 2), v.Cells(xrow, 2)).Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End With
Workbooks(aug & ".xlsx").Activate
Workbooks(aug & ".xlsx").Worksheets(sn).Select
With ActiveSheet
Range("B10").Select
Selection.Copy
End With
v.Activate
With ActiveSheet
xrow = v.Cells(v.Rows.Count, 3).End(xlUp).Row + 1
v.Range(v.Cells(xrow, 3), v.Cells(xrow, 3)).Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End With
Workbooks(aug & ".xlsx").Activate
Workbooks(aug & ".xlsx").Worksheets(sn).Select
With ActiveSheet
Range("D14").Select
Selection.Copy
End With
v.Activate
With ActiveSheet
xrow = v.Cells(v.Rows.Count, 4).End(xlUp).Row + 1
v.Range(v.Cells(xrow, 4), v.Cells(xrow, 4)).Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End With
Workbooks(aug & ".xlsx").Activate
Workbooks(aug & ".xlsx").Worksheets(sn).Select
With ActiveSheet
Range("D18").Select
Selection.Copy
End With
v.Activate
With ActiveSheet
xrow = v.Cells(v.Rows.Count, 5).End(xlUp).Row + 1
v.Range(v.Cells(xrow, 5), v.Cells(xrow, 5)).Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End With
Next
End Sub
Bookmarks