I have been racking my brain over this code. I am trying to copy a set of data from table "CST" to the end of a currently populated table titled "HT_Table" and input the type of test that was run for the entries I am pasting. The historical data table should have a running list of entries.
Each time I run the macro I want to copy "[[Social Security Number]:[Rehire Date]]" into the bottom of a different table that has a running list of selections and add "Loan" to the right of it under the "Test" column.
Sub Copy_Data
'Copy critical data
     Dim tbl As ListObject
     Set tbl = CST.ListObjects(1)
     Range(tbl & "[[Social Security Number]:[Rehire Date]]").Copy   
     Windows("Historical Testing.xlsx").Activate
'I named the column in the table I am pasting to "SSN" 
    Range("SSN").End(xlDown).Select
    ActiveCell.Offset(1, 0).PasteSpecial
    Dim PY As Worksheet
    Set PY = ActiveSheet
    With PY.ListObjects("HT_Table")
    .ListColumns("Test").Range.Select
    ActiveCell.End(xlDown).Select
    ActiveCell.Offset(1, 0).Select
    Range(Selection, Selection.End(xlDown)) = "Loan"
    End With
End Sub
I run into problems with the Selection.End(x1Down)) if there is only one row pasted to the bottom of the table. The above code selects the one row and then highlights all the way to the end of the worksheet.
