Hello everyone!
For a small project I am having the following issue at the moment:

I copy columns from one worksheet into the other, depending on what is written in the first row.
Let's say if it says "Name" then it will copy the entire column to the other worksheet.
Now I have the problem that it copies the entire column. By that I mean that also all empty cells are copied as well, which I would like to change.
How can I make the code so that it only copies data from until the last row that has actual data in it?

So the code is very simple and looks like following:

Public Sub copy()
    Dim c As Range
    Dim j As Integer
    Dim Source As Worksheet
    Dim Target As Worksheet
    

 
    Set Source = ActiveWorkbook.Worksheets("Data")
    Set Target = ActiveWorkbook.Worksheets("dont_touch")

    j = 1     ' Start copying to row 1 in target sheet
    For Each c In Source.Range("A1:Z1")   ' Do 1000 rows
        If c = "Name" Then
           Source.Columns(c.Column).Copy Target.Columns(j)
           j = j + 1
        End If
    Next c
    j = 2     ' Start copying to row 2 in target sheet
    For Each c In Source.Range("A1:Z1")   
        If c = "Age" Then
           Source.Columns(c.Column).Copy Target.Columns(j)
           j = j + 1
        End If
    Next c
   Application.ScreenUpdating = True
    
End Sub
Thanks a lot in advance!