'Looking up a job from a training matrix to create list of required trainings

Training matrix snip

I am creating a training matrix with the documents in a column down the left side and the job titles across the top (see image snip). If a training is required for that job, an X is placed next to that document in that job's column. I want to create a lookup sheet with a dropdown menu of all job titles. The user can select the job title and then it will output a list of all the training documents (column 1) required for the job, but I can't get the code to go past the first row.

This is my first time working with VBA so I may be on the complete wrong track, but can't seem to find something that will work. Here is what I have tried:

Sub trainingLookup()

Sheets("Training Lookup").Range("A6:A400").ClearContents

Item = Sheets("Training Lookup").Cells(2, 1).Value
k = 6 'the row on the lookup sheet that correct training will populate
r = 2 'the row in the matrix to look at

For i = 5 To 500 'the column on the matrix that the script is looking up
    If Sheets("Training Matrix by Title").Cells(1, i) = Item Then
        If Sheets("Training Matrix by Title").Cells(r, i) = "x" Then
            Sheets("Training Lookup").Cells(k, 1) = Sheets("Training Matrix by Title").Cells(r, 1).Value
         r = r + 1
         k = k + 1
         End If
        
      End If
  
     Next i

End Sub


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source