I have userform to input scores. I need help to get BYE from bye week worksheet

TLS49

Board Regular
Joined
Nov 26, 2019
Messages
135
Office Version
  1. 365
Platform
  1. Windows
download file here

NEED HELP PUT BYE ON USERFORM AUTOMATICALLY FROM BYE WEEK WORKSHEET.xlsb
ABCDEFGHIJKLMNOPQ
1BYE WEEK 1TEAMSBYE WEEK 2TEAMSBYE WEEK 3TEAMSBYE WEEK 4TEAMSBYE WEEK 5TEAMSBYE WEEK 6TEAMS
2111111LIONS
3222223RAIDERS
4333332TEXANS
5444444TITANS
6555555
7666666
8
9BYE WEEK 7TEAMSBYE WEEK 8TEAMSBYE WEEK 9TEAMSBYE WEEK 10TEAMSBYE WEEK 11TEAMSBYE WEEK 12TEAMS
101BILLS1CHIEFS1BROWNS1RAVENS1JAGUARS1
112RAMS2CHARGERS2COWBOYS2BENGALS2DOLPHINS2
123VIKINGS33BRONCOS3PATRIOTS3SEAHAWKS3
134EAGLES44GIANTS4JETS4BUCCANEERS4
145516STEELERS555
1566649ERS666
16
17BYE WEEK 13TEAMSBYE WEEK 14TEAMSBYE WEEK 15TEAMSBYE WEEK 16TEAMSBYE WEEK 17TEAMSBYE WEEK 18TEAMS
181CARDINALS1FALCONS1111
192PANTHERS2BEARS2222
2033PACKERS3333
2144COLTS4444
2255SANTS5555
2366COMMANDERS6666
BYE WEEKS



NEED HELP PUT BYE ON USERFORM AUTOMATICALLY FROM BYE WEEK WORKSHEET.xlsb
ABCDEFGHIJKLMNOPQRS
1TEAMS123456789101112131415161718
2BILLS314119233824271730312824203235NO GAME35
3DOLPHINS2042211517161631353930171729202111
4JETS93112244027161720331221217366
5PATRIOTS717262429381422261026102724182323
6BENGALS201727271730311342372027233422NO GAME27
7BROWNS2630292028152032172323271013102414
8RAVENS243837201920232727132710163171316
9STEELERS231417203201013203024191424131628
10COLTS2002017123410163251617193631031
11JAGUARS222438216271717271728143640193120
12TEXANS209202413BYE20101716101514232419332
13TITANS207242421191717172716102214141316
14BRONCOS1616112391692110161092824142431
15CHARGERS2424103430192320162725202317203128
16CHIEFS4427174130204420273026243430242731
17RAIDERS192322322938020202240271630103413
18COMMANDERS282781017122317173223192012201026
19COWBOYS32023252217244928402854273440276
20EAGLES3824242920263529211740354825341022
21GIANTS2119162027242313241820202220243816
22BEARS191023122273329323024101920131013
23LIONS35362445062715313125403420234120
24PACKERS72714272210213493117332824264116
25VIKINGS23728282924342033333272339271729
26BUCCANEERS19201231211832216211717723193017
27FALCONS262727231528173717152713161892030
28PANTHERS241622161510213421253233016372410
29SAINTS27101425392634241310270162117207
3049ERS1027102437142331223813333521373738
31CARDINALS211612261794226212710241315161913
32RAMS103120910241413172010231712511016
33SEAHAWKS177234832193727311634272413102319
INPUT SCORES
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:S33Cell Value="BYE"textNO










NFL_SCORES_FORMS.jpg


I have userform to input scores. I need help to get bye from bye week worksheet. I need help to get bye team from bye week worksheet put BYE on the nfll_scores_form by vba code. I put bye in week 6 have Texans BYE in textbox manually on userform show what I want for rest teams. Next year bye can be on different week. On the form how combo box for week 1 to 18.

Thanks you

TLS49
 
Last edited:

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Try this code for your cmbweek event code (see modification at the end of the sub).
It seemed to work when I ran a quick test
I enter "BYE" only in the displayed form. When you click "Send Scores" the BYES (as well as all other scores are written to the "INPUT SCORES" sheet.
VBA Code:
Private Sub cmbweeks_Change()
 Dim Ws As Worksheet
 Dim WsBye As Worksheet
 Dim r As Long, c As Long
 Dim i As Long, j As Long
    
    Set Ws = Worksheets("INPUT SCORES")
    Set WsBye = Worksheets("BYE WEEKS")
    NFL_SCORES_FORM.txtbills.SetFocus
   
    With Me
        'SENDING TO FORM             2 to 33 ROWS
        
        'AFC EAST TEAMS
        .txtbills.Value = Ws.Cells(2, Me.cmbweeks.Value + 1)
        .txtdolphins.Value = Ws.Cells(3, Me.cmbweeks.Value + 1)
        .txtjets.Value = Ws.Cells(4, Me.cmbweeks.Value + 1)
        .txtpatriots.Value = Ws.Cells(5, Me.cmbweeks.Value + 1)
        
        'AFC NORTH TEAMS
        .txtbengals.Value = Ws.Cells(6, Me.cmbweeks.Value + 1)
        .txtbrowns.Value = Ws.Cells(7, Me.cmbweeks.Value + 1)
        .txtravens.Value = Ws.Cells(8, Me.cmbweeks.Value + 1)
        .txtsteelers.Value = Ws.Cells(9, Me.cmbweeks.Value + 1)
        
        'AFC SOUTH TEAMS
        .txtcolts.Value = Ws.Cells(10, Me.cmbweeks.Value + 1)
        .txtjaguars.Value = Ws.Cells(11, Me.cmbweeks.Value + 1)
        .txttexans.Value = Ws.Cells(12, Me.cmbweeks.Value + 1)
        .txttitans.Value = Ws.Cells(13, Me.cmbweeks.Value + 1)
        
        'AFC WEST TEAMS
        .txtbroncos.Value = Ws.Cells(14, Me.cmbweeks.Value + 1)
        .txtchargers.Value = Ws.Cells(15, Me.cmbweeks.Value + 1)
        .txtchiefs.Value = Ws.Cells(16, Me.cmbweeks.Value + 1)
        .txtraiders.Value = Ws.Cells(17, Me.cmbweeks.Value + 1)
        
        'NFC EAST TEAMS
        .txtcommanders.Value = Ws.Cells(18, Me.cmbweeks.Value + 1)
        .txtcowboys.Value = Ws.Cells(19, Me.cmbweeks.Value + 1)
        .txteagles.Value = Ws.Cells(20, Me.cmbweeks.Value + 1)
        .txtgiants.Value = Ws.Cells(21, Me.cmbweeks.Value + 1)
        
        'NFC NORTH TEAMS
        .txtbears.Value = Ws.Cells(22, Me.cmbweeks.Value + 1)
        .txtlions.Value = Ws.Cells(23, Me.cmbweeks.Value + 1)
        .txtpackers.Value = Ws.Cells(24, Me.cmbweeks.Value + 1)
        .txtvikings.Value = Ws.Cells(25, Me.cmbweeks.Value + 1)
        
        'NFC SOUTH TEAMS
        .txtbuccaneers.Value = Ws.Cells(26, Me.cmbweeks.Value + 1)
        .txtfalcons.Value = Ws.Cells(27, Me.cmbweeks.Value + 1)
        .txtpanthers.Value = Ws.Cells(28, Me.cmbweeks.Value + 1)
        .txtsaints.Value = Ws.Cells(29, Me.cmbweeks.Value + 1)
        
        'NFC WEST TEAMS
        .txt49ers.Value = Ws.Cells(30, Me.cmbweeks.Value + 1)
        .txtcardinals.Value = Ws.Cells(31, Me.cmbweeks.Value + 1)
        .txtrams.Value = Ws.Cells(32, Me.cmbweeks.Value + 1)
        .txtseahawks.Value = Ws.Cells(33, Me.cmbweeks.Value + 1)
        
        'BYE's for the selected week
        r = Int((Val(.cmbweeks.Value) - 1) / 6) * 8 + 1
        c = (Int((Val(.cmbweeks.Value) - 1) * 3) + 2) Mod 18
        
        For i = 1 To 6
          r = r + 1
          If Not IsEmpty(WsBye.Cells(r, c)) Or Len(WsBye.Cells(r, c)) > 0 Then
            team = WsBye.Cells(r, c)
            .Controls("txt" & team).Value = "BYE"
          End If
        Next i
        
    End With
End Sub
 
Upvote 0
Try this code for your cmbweek event code (see modification at the end of the sub).
It seemed to work when I ran a quick test
I enter "BYE" only in the displayed form. When you click "Send Scores" the BYES (as well as all other scores are written to the "INPUT SCORES" sheet.
VBA Code:
Private Sub cmbweeks_Change()
 Dim Ws As Worksheet
 Dim WsBye As Worksheet
 Dim r As Long, c As Long
 Dim i As Long, j As Long
 
    Set Ws = Worksheets("INPUT SCORES")
    Set WsBye = Worksheets("BYE WEEKS")
    NFL_SCORES_FORM.txtbills.SetFocus
 
    With Me
        'SENDING TO FORM             2 to 33 ROWS
     
        'AFC EAST TEAMS
        .txtbills.Value = Ws.Cells(2, Me.cmbweeks.Value + 1)
        .txtdolphins.Value = Ws.Cells(3, Me.cmbweeks.Value + 1)
        .txtjets.Value = Ws.Cells(4, Me.cmbweeks.Value + 1)
        .txtpatriots.Value = Ws.Cells(5, Me.cmbweeks.Value + 1)
     
        'AFC NORTH TEAMS
        .txtbengals.Value = Ws.Cells(6, Me.cmbweeks.Value + 1)
        .txtbrowns.Value = Ws.Cells(7, Me.cmbweeks.Value + 1)
        .txtravens.Value = Ws.Cells(8, Me.cmbweeks.Value + 1)
        .txtsteelers.Value = Ws.Cells(9, Me.cmbweeks.Value + 1)
     
        'AFC SOUTH TEAMS
        .txtcolts.Value = Ws.Cells(10, Me.cmbweeks.Value + 1)
        .txtjaguars.Value = Ws.Cells(11, Me.cmbweeks.Value + 1)
        .txttexans.Value = Ws.Cells(12, Me.cmbweeks.Value + 1)
        .txttitans.Value = Ws.Cells(13, Me.cmbweeks.Value + 1)
     
        'AFC WEST TEAMS
        .txtbroncos.Value = Ws.Cells(14, Me.cmbweeks.Value + 1)
        .txtchargers.Value = Ws.Cells(15, Me.cmbweeks.Value + 1)
        .txtchiefs.Value = Ws.Cells(16, Me.cmbweeks.Value + 1)
        .txtraiders.Value = Ws.Cells(17, Me.cmbweeks.Value + 1)
     
        'NFC EAST TEAMS
        .txtcommanders.Value = Ws.Cells(18, Me.cmbweeks.Value + 1)
        .txtcowboys.Value = Ws.Cells(19, Me.cmbweeks.Value + 1)
        .txteagles.Value = Ws.Cells(20, Me.cmbweeks.Value + 1)
        .txtgiants.Value = Ws.Cells(21, Me.cmbweeks.Value + 1)
     
        'NFC NORTH TEAMS
        .txtbears.Value = Ws.Cells(22, Me.cmbweeks.Value + 1)
        .txtlions.Value = Ws.Cells(23, Me.cmbweeks.Value + 1)
        .txtpackers.Value = Ws.Cells(24, Me.cmbweeks.Value + 1)
        .txtvikings.Value = Ws.Cells(25, Me.cmbweeks.Value + 1)
     
        'NFC SOUTH TEAMS
        .txtbuccaneers.Value = Ws.Cells(26, Me.cmbweeks.Value + 1)
        .txtfalcons.Value = Ws.Cells(27, Me.cmbweeks.Value + 1)
        .txtpanthers.Value = Ws.Cells(28, Me.cmbweeks.Value + 1)
        .txtsaints.Value = Ws.Cells(29, Me.cmbweeks.Value + 1)
     
        'NFC WEST TEAMS
        .txt49ers.Value = Ws.Cells(30, Me.cmbweeks.Value + 1)
        .txtcardinals.Value = Ws.Cells(31, Me.cmbweeks.Value + 1)
        .txtrams.Value = Ws.Cells(32, Me.cmbweeks.Value + 1)
        .txtseahawks.Value = Ws.Cells(33, Me.cmbweeks.Value + 1)
     
        'BYE's for the selected week
        r = Int((Val(.cmbweeks.Value) - 1) / 6) * 8 + 1
        c = (Int((Val(.cmbweeks.Value) - 1) * 3) + 2) Mod 18
     
        For i = 1 To 6
          r = r + 1
          If Not IsEmpty(WsBye.Cells(r, c)) Or Len(WsBye.Cells(r, c)) > 0 Then
            team = WsBye.Cells(r, c)
       .Controls("txt" & team).Value = "BYE"
          End If
        Next i
     
    End With
End Sub
I put code in my file, and it gave me an error. I red highlight where the error is locate .Controls("txt" & team).Value = "BYE"





Thank You
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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