Results 1 to 8 of 8

Adding Toggle to Hidden Rows Sheet

Threaded View

  1. #1
    Registered User
    Join Date
    08-16-2011
    Location
    GA, USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Adding Toggle to Hidden Rows Sheet

    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
    Attached Files Attached Files
    Last edited by tkbulldog; 08-29-2011 at 10:17 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1