GaryHJones

New Member
Joined
Sep 28, 2019
Messages
2
I have been trying to find a solution to my problem, but cant seem to find one.

i have a spreadsheet with names in column A, and events in column B and dates in column C.

the format of the sheet, is like this

Column A Column B Column C
Fred Bloggs
Male 50 Freestyle09/03/2019
1
Male 100 Freestyle31/03/2019
1
Male 200 Freestyle01/02/2019
1
Male 400 Freestyle21/09/2019
1
Male 800 Freestyle13/09/2019
1
Male 50 Breaststroke22/09/2019
1
Male 100 Breaststroke01/02/2019
1
Male 200 Breaststroke02/02/2019
1
Male 50 Butterfly21/09/2019
1
Male 100 Butterfly07/07/2019
1
Male 200 Butterfly03/02/2019
1
Male 50 Backstroke22/09/2019
1
Male 100 Backstroke22/09/2019
1
Male 200 Backstroke21/09/2019
1
Male 100 Individual Medley09/03/2019
1
Male 200 Individual Medley22/09/2019
Bill Bob1
Male 50 Freestyle16/06/2019
1
Male 100 Freestyle23/03/2019
1
Male 50 Breaststroke16/06/2019
1
Male 50 Butterfly16/06/2019
1
Male 50 Backstroke16/06/2019
1
Male 100 Individual Medley16/06/2019

<colgroup><col width="95" style="width: 71pt;"><col width="173" style="width: 130pt;"><col width="93" style="width: 70pt;"></colgroup><tbody>
</tbody>

i have a another sheet where i want to be able to select a name from a validated List of Names , and return the correct dates for each of the events listed.

i don't want to have to copy the names down, against the events as there are 100s of names and events.
thanks for any help anyone can give.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
This assumes you are using a validation drop down list. You did not specify where on "another sheet" you have the list but the code below uses cell A1 of Sheet 2 to illustate the method. You can change the code to reflect the correct cell for the drop down list.
Code:
Sub t()
Dim sh1 As Worksheet, sh2 As Worksheet, fn As Range, rng As Range, cel As Range
Set sh1 = Sheets(1)
Set sh2 = Sheets(2)
lr = sh1.Cells.Find("*", , xlValues, xlPart, xlByRows, xlPrevious).Row
    If sh2.Range("A1") <> "" Then
        Set fn = sh1.Range("A:A").Find(sh2.Range("A1").Value, , xlValues, xlWhole)
            If Not fn Is Nothing Then
                If fn.End(xlDown).Row > lr Then
                    Set cel = sh1.Cells(lr, 3)
                Else
                    Set cel = fn.End(xlDown).Offset(-1, 2)
                End If
                Set rng = sh1.Range(fn.Offset(2, 1), cel)
            End If
        rng.Copy sh2.Range("B3")
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,496
Members
449,089
Latest member
Raviguru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top