Results 1 to 10 of 380

Thread: Appendix Thread. ( Codes for other Threads, etc.) Event Coding Drpdown Data validation

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    This final version may need a bit of tweaking if you, me, or both of us have muddled up the logic, but I think you can see the general idea
    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Application.Intersect(Target, Me.Range("C5:C24")) Is Nothing Then Exit Sub
        If Target.Row = 5 Then        '       Target.Column = 3 And Target.Row = 5 Then
            If Target.Value = "Yes" Then
             Let Worksheets("FAR").Rows("14").Hidden = False
             Let Worksheets("Additions").Rows("6").Hidden = False
            ElseIf Target.Value = "No" Then
             Let Worksheets("FAR").Rows("14").Hidden = True
             Let Worksheets("Additions").Rows("6").Hidden = True
            End If
        End If
    
    ' hide row 14 in Tab FAR and Row 7 in Tab Additions if the value in row 6 Tab Additions is "NO" and leave unhidden if yes
    ' hide row 15 in Tab FAR and Row 8 in Tab Additions if the value in row 7 Tab Additions is "NO" and leave unhidden if yes
    ' hide row 16 in Tab FAR and Row 9 in Tab Additions if the value in row 8 Tab Additions is "NO" and leave unhidden if yes
    ' ......and so fort 20 times
        If Target.Row > 5 And Target.Row < 25 Then  ' for rows 6,7,8.....24
            If Target.Value = "No" Then
             Let Worksheets("FAR").Rows("" & Target.Row + 8 & "").Hidden = True
             Let Worksheets("Additions").Rows("" & Target.Row + 1 & "").Hidden = True
            ElseIf Target.Value = "Yes" Then  '  leave unhidden if yes
             Let Worksheets("FAR").Rows("" & Target.Row + 8 & "").Hidden = False
             Let Worksheets("Additions").Rows("" & Target.Row + 1 & "").Hidden = False
            End If
        End If
    
    End Sub



    This next version is not too efficient / slower, but might help to see what is going on:
    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Application.Intersect(Target, Me.Range("C5:C24")) Is Nothing Then Exit Sub
        If Target.Row = 5 Then        '       Target.Column = 3 And Target.Row = 5 Then
            If Target.Value = "Yes" Then
             Worksheets("FAR").Activate
             Let Worksheets("FAR").Rows("14").Hidden = False
             Worksheets("Additions").Activate
             Let Worksheets("Additions").Rows("6").Hidden = False
            ElseIf Target.Value = "No" Then
             Worksheets("FAR").Activate
             Let Worksheets("FAR").Rows("14").Hidden = True
             Worksheets("Additions").Activate
             Let Worksheets("Additions").Rows("6").Hidden = True
            End If
        End If
    
    ' hide row 14 in Tab FAR and Row 7 in Tab Additions if the value in row 6 Tab Additions is "NO" and leave unhidden if yes
    ' hide row 15 in Tab FAR and Row 8 in Tab Additions if the value in row 7 Tab Additions is "NO" and leave unhidden if yes
    ' hide row 16 in Tab FAR and Row 9 in Tab Additions if the value in row 8 Tab Additions is "NO" and leave unhidden if yes
    ' ......and so fort 20 times
        If Target.Row > 5 And Target.Row < 25 Then  ' for rows 6,7,8.....24
            If Target.Value = "No" Then
             Worksheets("FAR").Activate
             Let Worksheets("FAR").Rows("" & Target.Row + 8 & "").Hidden = True
             Worksheets("Additions").Activate
             Let Worksheets("Additions").Rows("" & Target.Row + 1 & "").Hidden = True
            ElseIf Target.Value = "Yes" Then  '  leave unhidden if yes
             Worksheets("FAR").Activate
             Let Worksheets("FAR").Rows("" & Target.Row + 8 & "").Hidden = False
             Worksheets("Additions").Activate
             Let Worksheets("Additions").Rows("" & Target.Row + 1 & "").Hidden = False
            End If
        End If
    
    End Sub



    Alan


    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=SIDLFRkUEIo&lc=UgzTF5vvB67Zbfs9qvx4AaABAg
    https://www.youtube.com/watch?v=v_1iqtOnUMg&lc=UgxLtKj969oiIu7zNb94AaABAg
    https://www.youtube.com/watch?v=f7xZivqLZxc&lc=Ugxq4JHRza_zx3sz0fx4AaABAg
    https://www.youtube.com/watch?v=f7xZivqLZxc&lc=Ugxq4JHRza_zx3sz0fx4AaABAg
    https://www.youtube.com/watch?v=f7xZivqLZxc&lc=UgzMCQUIQgrbec400jl4AaABAg
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz0Uy2bCSCTb1W-0_14AaABAg
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=Ugx12mI-a39T41NaZ8F4AaABAg.9iDQqIP56NV9iFD0AkeeJG
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgzFkoI0n_BxwnwVMcZ4AaABAg
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz0Uy2bCSCTb1W-0_14AaABAg.9htChVuaX9W9htG01cKBzX
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugw6UrV69zpeKvLOeOV4AaABAg.9ht16tzryC49htJ6TpIO XR
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgwMKwGZpDjv7vi7pCx4AaABAg
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugw6UrV69zpeKvLOeOV4AaABAg.9ht16tzryC49htOKs4jh 3M
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgxVW-am20rQ5GFuJ9F4AaABAg
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Attached Files Attached Files
    Last edited by DocAElstein; 10-24-2023 at 02:22 PM.

Similar Threads

  1. Replies: 192
    Last Post: 08-30-2025, 01:34 AM
  2. Replies: 293
    Last Post: 09-24-2020, 01:53 AM
  3. Appendix Thread. Diet Protokol Coding Adaptions
    By DocAElstein in forum Test Area
    Replies: 6
    Last Post: 09-05-2019, 10:45 AM
  4. Restrict data within the Cell (Data Validation)
    By dritan0478 in forum Excel Help
    Replies: 1
    Last Post: 07-27-2017, 09:03 PM

Posting Permissions

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