Hi guys,
I am new to the forum and Excel I am designing a spreadsheet for my fantasy football draft. I have written the following code to hide cells as I assign a Team to each player via a drop down box.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range, r As Range
Set rng = Intersect(Target, Columns(2), Rows("6:" & Rows.Count))
If Not rng Is Nothing Then
For Each r In rng
With r.MergeArea
.EntireRow.Hidden = _
(.Cells(1).Value = "Team 1") + (.Cells(1).Value = "Team 2") + (.Cells(1).Value = "Team 3") + (.Cells(1).Value = "Team 4") + (.Cells(1).Value = "Team 5") + (.Cells(1).Value = "Team 6") + (.Cells(1).Value = "Team 7") + (.Cells(1).Value = "Team 8") + (.Cells(1).Value = "Team 9") + (.Cells(1).Value = "Team 10")
End With
Next
End If
Set rng = Nothing
End Sub
I know this code can probably be done much simpler but this is the way I could get it to work
.
My problem comes in trying to add a Toggle button to switch my hidden rows on and off. I can't seem to figure out what to do with the duplicate Private Sub that the toggle button code uses.
I also am having a hard time writing the code to have each player's name show up on the Team's tab after being selected on the Draft Tab. I would like each player to show up in the columns associated with each team by position if possible. For example if Adrian Peterson is drafted by Team 1 he would show up in the RB slot for team 1. If the RB slots are full then that player would show up on the BE.
I don't know if this is possible but I was hoping someone can help point me in the right direction.
Thanks,
TKBulldog
Bookmarks