Preacherman771
New Member
- Joined
- Jun 15, 2021
- Messages
- 46
- Office Version
- 365
- Platform
- Windows
After being helped with a previous project dealing with dropdown list and VBA code resulting in working perfectly, I had a similar task on the project which I'm currently working on and used the VBA code making the proper changes according to worksheet. When applying the code and changing the necessary changes and pressing Ctr-Q it worked fine once and when I attempted a second and further attempts, it no longer does anything. What I'm trying to accomplish is pull down on the drop list and when selecting a given item, it should navigate to a given point on the worksheet. I do need to share that I also have another dropdown list which has it's own VBA code, and is still working properly, for the current worksheet which changes the schedule information as a team name is selected. When I applied the new VBA code above the other VBA code series, as stated stated earlier, it worked once, and then would no longer do anything. I even entered it at the end of the current codes.
Here is the a copy of the worksheet which has both dropdown lists. The one in question is the one which is "Week-1, Week-2, etc". I have pasted the VBA codes for both dropdowns. The first group is for the one in question and the other two are for the other dropdown which is working accurately:
Here is the a copy of the worksheet which has both dropdown lists. The one in question is the one which is "Week-1, Week-2, etc". I have pasted the VBA codes for both dropdowns. The first group is for the one in question and the other two are for the other dropdown which is working accurately:
NFL 2021-2022 Standings (Template).xlsm | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | |||
2 | NFL 2021/22 | |||||||||||||||||
3 | Team Game Schedule | |||||||||||||||||
4 | ||||||||||||||||||
5 | Buffalo Bills | Week-4 | ||||||||||||||||
6 | ||||||||||||||||||
7 | ||||||||||||||||||
8 | REGULAR SEASON | |||||||||||||||||
9 | ||||||||||||||||||
10 | ||||||||||||||||||
11 | ||||||||||||||||||
12 | ||||||||||||||||||
13 | Week-1 | Sun 9/12 | FINAL | L | 16 | - | 23 | |||||||||||
14 | ||||||||||||||||||
15 | LOGO | @ | Pittsburgh Steelers (1-0-0) | |||||||||||||||
16 | 1:00 PM EDT | CBS | ||||||||||||||||
17 | Bills Stadium, Orchard Park | Next Opponent: | @ | Miami Dolphins (1-1-0) | ||||||||||||||
18 | ||||||||||||||||||
19 | ||||||||||||||||||
20 | ||||||||||||||||||
21 | Week-2 | Sun 9/19 | FINAL | W | 35 | - | 0 | |||||||||||
22 | ||||||||||||||||||
23 | LOGO | @ | Miami Dolphins (1-1-0) | |||||||||||||||
24 | 1:00 PM EDT | FOX | ||||||||||||||||
25 | Hard Rock Stadium, Miami Gardens | Next Opponent: | @ | Washington Football (1-2-0) | ||||||||||||||
26 | ||||||||||||||||||
27 | ||||||||||||||||||
28 | ||||||||||||||||||
29 | Week-3 | Sun 9/26 | FINAL | W | 43 | - | 21 | |||||||||||
30 | ||||||||||||||||||
31 | LOGO | @ | Washington Football (1-2-0) | |||||||||||||||
32 | 1:00 PM EDT | FOX | ||||||||||||||||
33 | Bills Stadium, Orchard Park | Next Opponent: | @ | Houston Texans (1-3-0) | ||||||||||||||
34 | ||||||||||||||||||
Team_Schedule |
Cell Formulas | ||
---|---|---|
Range | Formula | |
G2 | G2 | =Sheet2!$I$8 |
G13 | G13 | =Calc_Team!B6 |
J13,J29,J21 | J13 | =IFERROR(INDEX(Tab_Schedule[Date],MATCH(1,($F$5=Tab_Schedule[Away])*($G13=Tab_Schedule[Wk'#]),0)),INDEX(Tab_Schedule[Date],MATCH(1,($F$5=Tab_Schedule[Home])*($G13=Tab_Schedule[Wk'#]),0))) |
K13,K29,K21 | K13 | =IFERROR(INDEX(Tab_Weekly[Weekly],MATCH(1,(#REF!=Tab_Weekly[Team])*($G13=Tab_Weekly[Wk'#]),0)),"") |
N13,N29,N21 | N13 | =IF($P13<>"---","FINAL","") |
P13,P29,P21 | P13 | =IF($J15="*BYE*","---",IFERROR(INDEX(Tab_Schedule[ResA],MATCH(1,($F$5=Tab_Schedule[Away])*($G13=Tab_Schedule[Wk'#]),0)),IFERROR(INDEX(Tab_Schedule[ResH],MATCH(1,($F$5=Tab_Schedule[Home])*($G13=Tab_Schedule[Wk'#]),0)),"---"))) |
Q13,Q29,Q21 | Q13 | =IF($J15="*BYE*","---",IFERROR(INDEX(Tab_Schedule[ScoreA],MATCH(1,($F$5=Tab_Schedule[Away])*($G13=Tab_Schedule[Wk'#]),0)),IFERROR(INDEX(Tab_Schedule[ScoreH],MATCH(1,($F$5=Tab_Schedule[Home])*($G13=Tab_Schedule[Wk'#]),0)),"---"))) |
S13,S29,S21 | S13 | =IF($J15="*BYE*","---",IFERROR(INDEX(Tab_Schedule[ScoreH],MATCH(1,($F$5=Tab_Schedule[Away])*($G13=Tab_Schedule[Wk'#]),0)),IFERROR(INDEX(Tab_Schedule[ScoreA],MATCH(1,($F$5=Tab_Schedule[Home])*($G13=Tab_Schedule[Wk'#]),0)),"---"))) |
I15,I31,I23 | I15 | =IF($J15="*BYE*","",IF(IFERROR(INDEX(Tab_Schedule[Stadium],MATCH(1,(#REF!=Tab_Schedule[Home])*($G13=Tab_Schedule[Wk'#]),0)),"---")="---","@","")) |
K16,K32,K24 | K16 | =IF($J15="*BYE*","---",IFERROR(INDEX(Tab_Schedule[Network],MATCH(1,($F$5=Tab_Schedule[Away])*($G13=Tab_Schedule[Wk'#]),0)),IFERROR(INDEX(Tab_Schedule[Network],MATCH(1,($F$5=Tab_Schedule[Home])*($G13=Tab_Schedule[Wk'#]),0)),"---"))) |
J15,J31,J23 | J15 | =IF(IFERROR(INDEX(Tab_Schedule[Away],MATCH(1,($G13=Tab_Schedule[Wk'#])*($F$5=Tab_Schedule[Home]),0)),IFERROR(INDEX(Tab_Schedule[Home],MATCH(1,($G13=Tab_Schedule[Wk'#])*($F$5=Tab_Schedule[Away]),0)),""))="*BYE*","*BYE*",(IF(IFERROR(INDEX(Tab_Schedule[Away],MATCH(1,($G13=Tab_Schedule[Wk'#])*($F$5=Tab_Schedule[Home]),0)),IFERROR(INDEX(Tab_Schedule[Home],MATCH(1,($G13=Tab_Schedule[Wk'#])*($F$5=Tab_Schedule[Away]),0)),""))="","",IFERROR(INDEX(Tab_Schedule[Away],MATCH(1,($G13=Tab_Schedule[Wk'#])*($F$5=Tab_Schedule[Home]),0)),IFERROR(INDEX(Tab_Schedule[Home],MATCH(1,($G13=Tab_Schedule[Wk'#])*($F$5=Tab_Schedule[Away]),0)),""))))&" ("&INDEX(Tab_Weekly[Weekly],MATCH(1,($G13=Tab_Weekly[Wk'#])* (IFERROR(INDEX(Tab_Schedule[Away],MATCH(1,($G13=Tab_Schedule[Wk'#])*($F$5=Tab_Schedule[Home]),0)),INDEX(Tab_Schedule[Home],MATCH(1,($G13=Tab_Schedule[Wk'#])*($F$5=Tab_Schedule[Away]),0)))=Tab_Weekly[Team]),0))&")") |
J16,J32,J24 | J16 | =IF($J15="*BYE*","---",IFERROR(INDEX(Tab_Schedule[Time],MATCH(1,($F$5=Tab_Schedule[Away])*($G13=Tab_Schedule[Wk'#]),0)),IFERROR(INDEX(Tab_Schedule[Time],MATCH(1,($F$5=Tab_Schedule[Home])*($G13=Tab_Schedule[Wk'#]),0)),"---"))) |
J17,J33,J25 | J17 | =IF($J15="*BYE*","---",IFERROR(INDEX(Tab_Schedule[Stadium],MATCH(1,($F$5=Tab_Schedule[Home])*($G13=Tab_Schedule[Wk'#]),0)),IFERROR(INDEX(Tab_Schedule[Stadium],MATCH(1,($F$5=Tab_Schedule[Away])*($G13=Tab_Schedule[Wk'#]),0)),"---"))) |
N17,N33,N25 | N17 | =IF(G13="Week-18","FINAL GAME","Next Opponent:") |
O17,O33,O25 | O17 | =IF(OR($P17="---",$G13="Week-17"),"",$I23) |
P17,P33,P25 | P17 | =IF(OR($N17="Final Game",$G13="Week-18"),"",$J23) |
G21 | G21 | =Calc_Team!B7 |
G29 | G29 | =Calc_Team!B8 |
Press CTRL+SHIFT+ENTER to enter array formulas. |
Cells with Data Validation | ||
---|---|---|
Cell | Allow | Criteria |
F5:O6 | List | =Calc_Team!$L$6:$L$37 |
P5:S6 | List | =Calc_Team!$B$6:$B$23 |
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("P5"), Target) Is Nothing Then
Dim JumpTo As Long, WeekNo As String
WeekNo = Target.Value
JumpTo = Application.Match(WeekNo, Me.Columns(7), 0) '<~~ assumes column G (1) change to suit
Application.Goto Me.Cells(JumpTo, 1), Scroll:=1
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Update by Extendoffice: 2020/01/16
Dim xCombox As OLEObject
Dim xStr As String
Dim xWs As Worksheet
Dim xArr
Set xWs = Application.ActiveSheet
On Error Resume Next
Set xCombox = xWs.OLEObjects("TempCombo")
With xCombox
.ListFillRange = ""
.LinkedCell = ""
.Visible = False
End With
If Target.Validation.Type = 3 Then
Target.Validation.InCellDropdown = False
Cancel = True
xStr = Target.Validation.Formula1
xStr = Right(xStr, Len(xStr) - 1)
If xStr = "" Then Exit Sub
With xCombox
.Visible = True
.Left = Target.Left
.Top = Target.Top
.Width = Target.Width + 5
.Height = Target.Height + 5
.ListFillRange = xStr
If .ListFillRange = "" Then
xArr = Split(xStr, ",")
Me.TempCombo.List = xArr
End If
.LinkedCell = Target.Address
End With
xCombox.Activate
Me.TempCombo.DropDown
End If
End Sub
Private Sub TempCombo_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Select Case KeyCode
Case 9
Application.ActiveCell.Offset(0, 1).Activate
Case 13
Application.ActiveCell.Offset(1, 0).Activate
End Select
End Sub
Last edited by a moderator: