Hi All

Wondering if someone can help me as I am pulling out what is left of my hair.

I am creating a excel file where the user will click the button to locate the latest file they need to check, open it and then the first part is it will pull in the required date, before it moves on later on.

However, I am getting an error on 400, so I am wondering if there is a memory leak in my code that I can't see? The file size for the template is only at 319kb - the file that I am currently opening to pull 1 sheet out of is larger at 10,844KB, however the error can appear before it even opens. This is my code at the moment:

Application.ScreenUpdating = False
Application.DisplayAlerts = False

Sheets("Payments to Check").Visible = True
 Sheets("Payments to Check").Select
    ActiveSheet.Rows("2:2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.ClearContents

Application.ScreenUpdating = True
Application.DisplayAlerts = True

Dim fNameAndPath As Variant, wb As Workbook, wab As Workbook
Set wab = ThisWorkbook
fNameAndPath = Application.GetOpenFilename(, Title:="Select File To Be Opened")
If fNameAndPath = False Then Exit Sub
Set wb = Workbooks.Open(fNameAndPath)

Application.ScreenUpdating = False
Application.DisplayAlerts = False

wb.Sheets("Payment List").Activate
ActiveSheet.Rows("17:17").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False

wab.Sheets("Payments to Check").Activate

wb.Sheets("Payment List").Range("A17:R500").Copy wab.Sheets("Payments to Check").Range("a2")
The first parts where I have had errors is:

Sheets("Payments to Check").Select
    ActiveSheet.Rows("2:2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.ClearContents
and if I take this out, it errors at here instead:

wb.Sheets("Payment List").Activate
ActiveSheet.Rows("17:17").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
The problem I have, because the data in the other sheet is formulated, I need to paste as values, so on it's own

wb.Sheets("Payment List").Range("A17:R500").Copy wab.Sheets("Payments to Check").Range("a2")
wont work, because I need the values paste.

Is anyone able to assist with this at all?

Thanks in advance.