Hello - I have one spreadsheet (1000 rows, 30 columns) where users filter down the data until they have the set of students_ids (Column A) that they want to work with.

Then they click a button which runs the code below to copy the student_id's from the current spreadsheet to another spreadsheet (Test Transfer Data.xls).

What I would like to do is modify the code to only paste the first 10 id's. So the maximum it will ever paste is 10 ids (even if they filter down to 100 rows) Similar to a select top 15.......

Thank in advance!!

Sub CopyData()
Dim DestBook As Workbook, SrcBook As Workbook
Application.ScreenUpdating = False
Set SrcBook = ThisWorkbook
On Error Resume Next
Set DestBook = Workbooks("Test Transfer Data.xls")
If DestBook Is Nothing Then
    Set DestBook = Workbooks.Open("C:\Test Transfer Data.xls")
    If Err.Number = 1004 Then 
        Set DestBook = Workbooks.Add
        SrcBook.Worksheets("Test_From").Range("a5:a1000").Copy
        DestBook.Worksheets("Test_To").Range("A1").PasteSpecial
        Application.CutCopyMode = False
        DestBook.SaveAs ("C:\Test Transfer Data.xls")
        DestBook.Close
    Else
        SrcBook.Worksheets("Test_From").Range("a5:a").Copy
        DestBook.Worksheets("Test_To").Range("A32").PasteSpecial
        Application.CutCopyMode = False
        DestBook.Save
        DestBook.Close
    End If
Else
       SrcBook.Worksheets("Test_From").Range("a5:a405").Copy
        DestBook.Worksheets("Test_To").Range("A32").PasteSpecial
        Application.CutCopyMode = False
End If
On Error GoTo 0
Set DestBook = Nothing
Set SrcBook = Nothing
End Sub