Results 1 to 7 of 7

Please help with this monster! Need help w/VBA codes to hide and unhide rows base on lists

Threaded View

  1. #1
    Registered User
    Join Date
    04-08-2013
    Location
    Texas, USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Please help with this monster! Need help w/VBA codes to hide and unhide rows base on lists

    I need help with this monster please! I know it is a lot but, I am not a programmer and have no idea on how to get this done. Can someone please help me?!?!?! I have attached the spreadsheet... this is what i need help on:

    I want rows 18 thru 62 hidden at first.
    If the answer to Y16 is yes I want rows 18:20 to unhide
    If the answer to Y19 is yes I want rows 21:23 to unhide
    If the answer to Y22 is yes I want rows 24:26 to unhide
    If the answer to Y25 is yes I want rows 27:29 to unhide
    If the answer to Y28 is yes I want rows 30:32 to unhide
    If the answer to Y31 is yes I want rows 33:35 to unhide
    If the answer to Y34 is yes I want rows 36:38 to unhide
    If the answer to Y37 is yes I want rows 39:41 to unhide
    If the answer to Y40 is yes I want rows 42:44 to unhide
    If the answer to Y43 is yes I want rows 45:47 to unhide
    If the answer to Y46 is yes I want rows 48:50 to unhide
    If the answer to Y49 is yes I want rows 51:53 to unhide
    If the answer to Y52 is yes I want rows 54:56 to unhide
    If the answer to Y55 is yes I want rows 57:59 to unhide
    If the answer to Y58 is yes I want rows 60:62 to unhide

    I have this code for Rows 64 – 70:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 18 And Target.Row = 64 Then
            If Target.Value = "No" Then
                Rows("64:68").Select
                Selection.EntireRow.Hidden = False
                Rows("69:70").Select
                Selection.EntireRow.Hidden = True
              
              ElseIf Target.Value = "Yes" Then
                Rows("65:68").Select
                Selection.EntireRow.Hidden = True
                Rows("68:70").Select
                Selection.EntireRow.Hidden = False
                        
                ElseIf Target.Value = "   " Then
                Rows("65:70").Select
                Selection.EntireRow.Hidden = True
                       
           End If
        End If
    End Sub
    Row 71 Column 16 I need the same code as above to occur. I tried to add the same code with different row info and it didn’t work. This did not work: (I just pasted it below the code above)

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 16 And Target.Row = 71 Then
            If Target.Value = "No" Then
                Rows("71:75").Select
                Selection.EntireRow.Hidden = False
                Rows("76:77").Select
                Selection.EntireRow.Hidden = True
              
              ElseIf Target.Value = "Yes" Then
                Rows("72:75").Select
                Selection.EntireRow.Hidden = True
                Rows("75:77").Select
                Selection.EntireRow.Hidden = False
                        
                ElseIf Target.Value = "   " Then
                Rows("72:77").Select
                Selection.EntireRow.Hidden = True
                       
           End If
        End If
    End Sub
    I need the same code once more for rows 111:118 based on T110

    I need for Row 82 to unhide if I81 is Yes
    I need for Row 83 to unhide if Q81 is Yes

    Please help me! Thank you!
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

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