Total VBA novice, trying to do some simple file modifications in excel via access. I need help navigating to the bottom row in excel to do some copy/pasting. Getting an "application defined or object defined error", marked by the "#" below. Please help!

Sub MRFDATAIMPORT()

Set xlApp = CreateObject("Excel.Application")
With xlApp
xlApp.workbooks.Open "C:\Users\xxxxx\Desktop\Account Book\ACCESS Version\Test Folder\Book1.xlsx"
xlApp.Visible = True
xlApp.Sheets("Sheet1").Select
xlApp.Columns("A:A").Select

xlApp.Selection.Delete Shift:=xlToLeft


xlApp.Columns("C:C").Select
xlApp.Selection.Delete Shift:=xlToLeft
xlApp.Columns("F:G").Select
xlApp.Selection.Delete Shift:=xlToLeft
xlApp.Columns("G:M").Select
xlApp.Selection.Delete Shift:=xlToLeft
xlApp.Columns("H:I").Select
xlApp.Selection.Delete Shift:=xlToLeft
xlApp.Columns("I:M").Select
xlApp.Selection.Delete Shift:=xlToLeft
xlApp.Columns("K:M").Select
xlApp.Selection.Delete Shift:=xlToLeft
xlApp.Columns("L:AG").Select
xlApp.Selection.Delete Shift:=xlToLeft
xlApp.Columns("A:A").Select
xlApp.Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
xlApp.Columns("H:H").Select
xlApp.Selection.Cut
xlApp.Columns("A:A").Select
xlApp.Activesheet.Paste
xlApp.Columns("C:C").Select
xlApp.Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
xlApp.Columns("C:C").Select
xlApp.Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
xlApp.Columns("H:H").Select
xlApp.Selection.Cut
xlApp.Columns("C:C").Select
xlApp.Activesheet.Paste
xlApp.Columns("F:F").Select
xlApp.Selection.Cut
xlApp.Columns("D:D").Select
xlApp.Activesheet.Paste
xlApp.Range("F8").Select
xlApp.ActiveCell.FormulaR1C1 = "Vendor Location"
xlApp.Columns("M:M").Select
xlApp.Selection.Cut
xlApp.Columns("H:H").Select
xlApp.Activesheet.Paste
xlApp.Columns("I:L").Select
xlApp.Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
xlApp.Columns("R:R").Select
xlApp.Selection.Cut
xlApp.Columns("I:I").Select
xlApp.Activesheet.Paste
xlApp.Columns("O:O").Select
xlApp.Selection.Cut
xlApp.Columns("J:J").Select
xlApp.Activesheet.Paste
xlApp.Columns("P:P").Select
xlApp.Selection.Cut
xlApp.Columns("K:K").Select
xlApp.Activesheet.Paste
xlApp.Range("L8").Select
xlApp.ActiveCell.FormulaR1C1 = "REPORT"
xlApp.Range("L9").Select
xlApp.ActiveCell.FormulaR1C1 = _
    "=CONCATENATE(TEXT(RC[-5],""MMM""),"" "",TEXT(RC[-5],""yyyy""),"" MRF"")"
xlApp.Range("L9").Select
xlApp.Selection.Copy
xlApp.Range("M9").Select
xlApp.Range("M9", xlApp.Selection.End(xlDown)).Select
xlApp.ActiveCell.Offset(0, -1).Select
xlApp.Range(Selection, Selection.End(xlUp)).Select
xlApp.Activesheet.Paste
xlApp.Application.CutCopyMode = False
xlApp.Selection.Copy
xlApp.Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
xlApp.Application.CutCopyMode = False
xlApp.Columns("N:R").Select
xlApp.Selection.Delete Shift:=xlToLeft
xlApp.Range("A1").Select
xlApp.ActiveCell.FormulaR1C1 = "Load ID"
xlApp.Range("B1").Select
xlApp.ActiveCell.FormulaR1C1 = "Inv BU"
xlApp.Range("C1").Select
xlApp.ActiveCell.FormulaR1C1 = "Category"
xlApp.Range("D1").Select
xlApp.ActiveCell.FormulaR1C1 = "Customer"
xlApp.Range("E1").Select
xlApp.ActiveCell.FormulaR1C1 = "Vendor"
xlApp.Range("J1").Select
xlApp.ActiveCell.FormulaR1C1 = "Invoice ID"

xlApp.Rows("1:7").Select
xlApp.Selection.Delete Shift:=xlUp
xlApp.Save
xlApp.workbooks.Close
Set xlApp = Nothing
End With

End Sub

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.