Hi all - so I'm trying to see if there's a shorter/better version of what I'm doing? I have a macro created that I look up a value from one workbook to another and copy everything that's from the 2nd workbook to the first workbook. But I want to know if there's a way to put this in loop till the last record and the look up value to be more efficient and cleaner? here's what the recorded macro looks like.
Windows("NonPersonnelExtract 07-23-18.xlsx").Activate
Range("D1").Select
Selection.AutoFilter
Windows("Transfer File.xlsx").Activate
Range("E2").Select
Selection.Copy
Windows("NonPersonnelExtract 07-23-18.xlsx").Activate
ActiveSheet.Range("$A$1:$J$107854").AutoFilter Field:=4, Criteria1:= _
"DAM1996"
ActiveWindow.SmallScroll Down:=-3
Range("B1:F22910").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Transfer File.xlsx").Activate
Sheets.Add After:=ActiveSheet
ActiveSheet.Paste
Cells.Select
Cells.EntireColumn.AutoFit
Range("B10").Select
Sheets("Non-personnel Transfers").Select
Range("E3").Select
Application.CutCopyMode = False
Selection.Copy
Windows("NonPersonnelExtract 07-23-18.xlsx").Activate
ActiveSheet.Range("$A$1:$J$107854").AutoFilter Field:=4, Criteria1:= _
"JOB8065"
ActiveWindow.SmallScroll Down:=-21
Range("B1:F105415").Select
Application.CutCopyMode = False
Selection.Copy
Range("B105415:F105415").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Transfer File.xlsx").Activate
Sheets("Sheet1").Select
Range("A4").Select
ActiveSheet.Paste
Sheets("Non-personnel Transfers").Select
Range("E4").Select
Application.CutCopyMode = False
Selection.Copy
Windows("NonPersonnelExtract 07-23-18.xlsx").Activate
ActiveSheet.Range("$A$1:$J$107854").AutoFilter Field:=4, Criteria1:= _
"JXZ2388"
ActiveWindow.SmallScroll Down:=-12
Range("B90712:F105206").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Transfer File.xlsx").Activate
Sheets("Sheet1").Select
Range("A5").Select
ActiveSheet.Paste
Sheets("Non-personnel Transfers").Select
Range("E5").Select
Application.CutCopyMode = False
Selection.Copy
Windows("NonPersonnelExtract 07-23-18.xlsx").Activate
ActiveSheet.Range("$A$1:$J$107854").AutoFilter Field:=4, Criteria1:= _
"KKS2759"
ActiveWindow.SmallScroll Down:=-12
Range("B107181:F107509").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Transfer File.xlsx").Activate
Sheets("Sheet1").Select
Range("A17").Select
ActiveSheet.Paste
Sheets("Non-personnel Transfers").Select
Range("E6").Select
Application.CutCopyMode = False
Selection.Copy
Windows("NonPersonnelExtract 07-23-18.xlsx").Activate
ActiveSheet.Range("$A$1:$J$107854").AutoFilter Field:=4, Criteria1:= _
"MXN8497"
ActiveWindow.SmallScroll Down:=-6
Range("B21893:F21893").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Transfer File.xlsx").Activate
Sheets("Sheet1").Select
Range("A20").Select
ActiveSheet.Paste
Sheets("Non-personnel Transfers").Select
Range("C11").Select
Windows("NonPersonnelExtract 07-23-18.xlsx").Activate
Range("D1").Select
Selection.AutoFilter
Windows("Transfer File.xlsx").Activate
Range("E2").Select
Selection.Copy
Windows("NonPersonnelExtract 07-23-18.xlsx").Activate
ActiveSheet.Range("$A$1:$J$107854").AutoFilter Field:=4, Criteria1:= _
"DAM1996"
ActiveWindow.SmallScroll Down:=-3
Range("B1:F22910").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Transfer File.xlsx").Activate
Sheets.Add After:=ActiveSheet
ActiveSheet.Paste
Cells.Select
Cells.EntireColumn.AutoFit
Range("B10").Select
Sheets("Non-personnel Transfers").Select
Range("E3").Select
Application.CutCopyMode = False
Selection.Copy
Windows("NonPersonnelExtract 07-23-18.xlsx").Activate
ActiveSheet.Range("$A$1:$J$107854").AutoFilter Field:=4, Criteria1:= _
"JOB8065"
ActiveWindow.SmallScroll Down:=-21
Range("B1:F105415").Select
Application.CutCopyMode = False
Selection.Copy
Range("B105415:F105415").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Transfer File.xlsx").Activate
Sheets("Sheet1").Select
Range("A4").Select
ActiveSheet.Paste
Sheets("Non-personnel Transfers").Select
Range("E4").Select
Application.CutCopyMode = False
Selection.Copy
Windows("NonPersonnelExtract 07-23-18.xlsx").Activate
ActiveSheet.Range("$A$1:$J$107854").AutoFilter Field:=4, Criteria1:= _
"JXZ2388"
ActiveWindow.SmallScroll Down:=-12
Range("B90712:F105206").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Transfer File.xlsx").Activate
Sheets("Sheet1").Select
Range("A5").Select
ActiveSheet.Paste
Sheets("Non-personnel Transfers").Select
Range("E5").Select
Application.CutCopyMode = False
Selection.Copy
Windows("NonPersonnelExtract 07-23-18.xlsx").Activate
ActiveSheet.Range("$A$1:$J$107854").AutoFilter Field:=4, Criteria1:= _
"KKS2759"
ActiveWindow.SmallScroll Down:=-12
Range("B107181:F107509").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Transfer File.xlsx").Activate
Sheets("Sheet1").Select
Range("A17").Select
ActiveSheet.Paste
Sheets("Non-personnel Transfers").Select
Range("E6").Select
Application.CutCopyMode = False
Selection.Copy
Windows("NonPersonnelExtract 07-23-18.xlsx").Activate
ActiveSheet.Range("$A$1:$J$107854").AutoFilter Field:=4, Criteria1:= _
"MXN8497"
ActiveWindow.SmallScroll Down:=-6
Range("B21893:F21893").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Transfer File.xlsx").Activate
Sheets("Sheet1").Select
Range("A20").Select
ActiveSheet.Paste
Sheets("Non-personnel Transfers").Select
Range("C11").Select