Track entries and events spreadsheet,

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am working on a spreadsheet for our track team. I am trying to get it so
the events that students are in are automatically shown when their name is
entered in an event. For example:
Cell B6 has an event. Cells B7 to B10 have names of participants. I want
those names to be compared to the names in Column J. If the name is found
the event in B6 is put into Column K, If there is already an event then it is
put into column L and so on. In the end it there should be a all of our
athletes names and the events they are in in the columns to the right of
their name.
 
Try this.

Sub TrackEvents()

Dim rngNames as range
Dim res as variant
Dim i as integer,col as integer

Set rngNames = Range("j:j")
For i = 7 To 10
res = Application.Match(Cells(i, "B"), rngNames, 0)
If Not IsError(res) Then
col = Cells(res, Columns.Count).End(xlToLeft).Column + 1
Cells(res, col) = Cells(6, "B")
End If
Next i
End Sub


HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top