ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Track entries and events spreadsheet, (https://www.excelbanter.com/excel-programming/357359-track-entries-events-spreadsheet.html)

ccoverne

Track entries and events spreadsheet,
 
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.




Toppers

Track entries and events spreadsheet,
 
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

"ccoverne" wrote:

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.





All times are GMT +1. The time now is 01:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com