I get the error stating that I can't make this change (or copy a range to a destination) because it will affect Pivot Table.

Now there are two solutions I thought of:

• Deleting Pivot Tables entirely. But this is pointless as my report requires it.
• Referencing table in targetWb.Sheets(n).Range("A2"). How would you copy a range to a destination that is a listobject in position cell A2?

Essentially, I am trying to import workbook from range to a table that is connected to a PivotTable.

Sub FillWithPastedVal_2() 'make this run twice for ECC and SRM

Dim i As Long, j As Long, n As Integer
Dim targetWb As Workbook
Dim f As String
Dim SheetN(1 To 2) As String
Dim SourceRng As Range

'Populate the array
SheetN(1) = "ECC Extract"
SheetN(2) = "SRM Extract"

Set targetWb = Workbooks("Outline Agreement Tool_m.xlsx")

For n = 1 To 2

    MsgBox "Workbook" & "(" & n & ")" & " for " & SheetN(n), vbInformation
    
    
    f = Application.GetOpenFilename(filefilter:="Excel Files,*.xl*;*.xm*")
        
    Set sourceWb = Workbooks.Open(f)
    
    With sourceWb.ActiveSheet
        i = .Cells(Rows.Count, 1).End(xlUp).Row
        j = .Cells(2, Columns.Count).End(xlToLeft).Column
    End With
    
    MsgBox sourceWb.Name & targetWb.Name
    
    Debug.Print "R" & i & " C" & j
    
    Set SourceRng = sourceWb.ActiveSheet.Range(Cells(2, 1), Cells(i, j))

'This should be OUTLINE AGREEMENT TOOL

    SourceRng.Copy targetWb.Sheets(n).Range("A2")
    

Next n