It's the beginning part that's giving me trouble. "file A", "file B", "file C", and "file D" are the four files that contain linked table data. "master file" is the file that houses the macro, and it's the file that I'm copying and pasting data into.
Sub Macro()
Application.ScreenUpdating = False
Workbooks.Open Filename:= _
"file A.xlsx"
ActiveWorkbook.RefreshAll
Application.Wait Now + TimeValue("00:00:20")
ActiveWorkbook.Save
Workbooks.Open Filename:= _
"file B.xlsx"
ActiveWorkbook.RefreshAll
Application.Wait Now + TimeValue("00:00:20")
ActiveWorkbook.Save
Workbooks.Open Filename:= _
"file C.xlsx"
ActiveWorkbook.RefreshAll
Application.Wait Now + TimeValue("00:00:20")
ActiveWorkbook.Save
Workbooks.Open Filename:= _
"file D.xlsx"
ActiveWorkbook.RefreshAll
Application.Wait Now + TimeValue("00:00:20")
ActiveWorkbook.Save
Range("A2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Windows("master file.xlsm").Activate
Sheets("Invoice Lines").Select
Range("A2").Select
ActiveSheet.Paste
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("A" & LR + 1).Select
Windows("file A.xlsx").Activate
Range("A2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("master file.xlsm").Activate
ActiveSheet.Paste
LR2 = Range("A" & Rows.Count).End(xlUp).Row
Range("A" & LR2 + 1).Select
Windows("file B.xlsx").Activate
Range("A2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("master file.xlsm").Activate
ActiveSheet.Paste
LR3 = Range("A" & Rows.Count).End(xlUp).Row
Range("A" & LR3 + 1).Select
Windows("file C.xlsx").Activate
Range("A2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("master file.xlsm").Activate
ActiveSheet.Paste
Windows("file A.xlsx").Activate
ActiveWindow.Close
Windows("file B.xlsx").Activate
ActiveWindow.Close
Windows("file C.xlsx").Activate
ActiveWindow.Close
Windows("file D.xlsx").Activate
ActiveWindow.Close
Application.ScreenUpdating = True
End Sub