Team Sport Registration File

benchris

New Member
Joined
Feb 10, 2016
Messages
24
Office Version
  1. 2019
Platform
  1. Windows
I am wondering what the best way would be to handle this. I have a team registration list which is shown below in abbreviated form. What I am trying to figure out is the best way to populate another tab based on Column A selection and then copy the rows for that selection to the appropriate sheet. I have separate sheets for Girls 3rd-8th and Boys 3rd-8th. Each grades registration would need to get moved to the correct sheet. With the list below there is one registration for each grade, and after copying in the registrations each row would get populated onto the correct sheet.

Curious if you have any way to accomplish this. I have done it with a pivot table and different slicers on each sheet, but it is not as clean as I would like.

Thanks!
Session nameFirst nameLast nameJersey SizePreferred Jersey #Shooting Shirt SizeShorts SizePrimary P/G: NamePrimary P/G: Cell phone numberPrimary P/G: Email addressSecondary P/G: NameSecondary P/G: Cell phone numberWilling to CoachSecondary P/G: Email address
3rd Grade GirlsFirst1Last1Youth MediumYMParent11112223333pemail1sgname1sgphone1Yessemail1
4th Grade GirlsFirst2Last2Youth MediumYSParent21112223333pemail2sgname2sgphone2Yessemail2
5th Grade GirlsFirst3Last3Youth LargeYLParent31112223333pemail3sgname3sgphone3Yessemail3
6th Grade GirlsFirst4Last4Youth MediumYMParent41112223333pemail4sgname4sgphone4Yessemail4
7th Grade GirlsFirst5Last5Youth MediumYMParent51112223333pemail5sgname5sgphone5Yessemail5
8th Grade GirlsFirst6Last6Youth MediumYMParent61112223333pemail6sgname6sgphone6Yessemail6
3rd Grade BoysFirst7Last7Youth MediumYMParent71112223333pemail7sgname7sgphone7Yessemail7
4th Grade BoysFirst8Last8Youth LargeYLParent81112223333pemail8sgname8sgphone8Yessemail8
5th Grade BoysFirst9Last9Youth MediumYMParent91112223333pemail9sgname9sgphone9Yessemail9
6th Grade BoysFirst10Last10Youth SmallYSParent101112223333pemail10sgname10sgphone10Yessemail10
7th Grade BoysFirst11Last11Adult SmallASParent111112223333pemail11sgname11sgphone11Yessemail11
8th Grade BoysFirst12Last12Adult SmallASParent121112223333pemail12sgname12sgphone12Yessemail12
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Hi,
try following code & see if does what you want


Place code in STANDARD module

Rich (BB code):
Option Explicit
Sub FilterColumn()
'dmt32 aug 2020
    Dim wsData      As Worksheet, wsNames As Worksheet, wsFilter As Worksheet
    Dim Datarng     As Range, FilterRange As Range
    Dim rowcount    As Long
    Dim FilterCol   As Variant
    Dim SheetName   As String
    
    On Error GoTo progend
'your master sheet
    Set wsData = ThisWorkbook.Worksheets("Sheet1")
    
'Column you are filtering
    FilterCol = "A"
    
    With Application
        .ScreenUpdating = False: .DisplayAlerts = False
    End With
'add filter sheet
    Set wsFilter = ThisWorkbook.Worksheets.Add
    
    With wsData
        .Activate
'add password if needed
        .Unprotect Password:=""
        
        Set Datarng = .Range("A1").CurrentRegion
        
'extract values from FilterCol'to filter sheet
        .Cells(1, FilterCol).Resize(Datarng.Rows.Count).AdvancedFilter Action:=xlFilterCopy, _
        CopyToRange:=wsFilter.Range("A1"), Unique:=True
        
        rowcount = wsFilter.Cells(wsFilter.Rows.Count, "A").End(xlUp).Row
'set Criteria
        wsFilter.Range("B1").Value = wsFilter.Range("A1").Value
        
        For Each FilterRange In wsFilter.Range("A2:A" & rowcount)
            SheetName = CStr(Left(FilterRange.Text, 31))
'check for blank cell in range
            If SheetName <> "" Then
'add the FilterRange to criteria
'exact matches only
                wsFilter.Range("B2").Formula = "=" & """=" & SheetName & """"
'check if sheet exists
                If Not Evaluate("ISREF('" & SheetName & "'!A1)") Then
'add new sheet
                    Worksheets.Add(After:=Sheets(Sheets.Count)).Name = SheetName
                End If
'set object variable to sheet
                Set wsNames = Worksheets(SheetName)
'clear sheet
                wsNames.UsedRange.Clear
'copy data
                Datarng.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=wsFilter.Range("B1:B2"), _
                CopyToRange:=wsNames.Range("A1"), Unique:=False

'size column widths to match master
'NB - slows code down a little
                Datarng.Rows(1).Copy
                wsNames.UsedRange.Rows(1).PasteSpecial xlPasteColumnWidths
            End If
'clear from memory
            Set wsNames = Nothing
'clear clipboard
            Application.CutCopyMode = False
'clear filter
            If .FilterMode Then .ShowAllData
        Next
        .Select
    End With
    
progend:
    If Not wsFilter Is Nothing Then wsFilter.Delete
    With Application
        .ScreenUpdating = True: .DisplayAlerts = True
    End With
    If Err <> 0 Then MsgBox (Error(Err)), vbCritical, "Error"
End Sub

Code should copy each row to the correct sheet based on Column A value - If sheet does not exist, code will create it.
Change the name of the master sheet shown in BOLD as required

Dave
 
Upvote 0
Solution
How would you go about adding the row of who selected Yes or Maybe in the Willing to coach column to another sheet and pull in their information?
 
Upvote 0
How would you go about adding the row of who selected Yes or Maybe in the Willing to coach column to another sheet and pull in their information?
Hi,
glad solution does what you want

To create a different set of tabs based on another column just change column letter in this line of the code

Rich (BB code):
'Column you are filtering
    FilterCol = "A"

As already stated, code will create the sheets based on Column value.

Dave
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,580
Members
449,039
Latest member
Arbind kumar

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