Hide/Unhide Rows

  • Hello, thank you to let me join the forum; this is my first post.


    In cell A1 to A20 I have a drop down list menu with 2 options: "ciao" and "bye"
    I'm trying to hide a row (1 to 20 in this case), when in cell A1 to A20 there is the word "ciao".
    I also need that the same row is unhide (so displayed) when there is a word different from "ciao".


    I need to run this MACRO continuosly and not by clicking "run".


    Do you have some suggestions?
    Is it possible?

  • If in A1 the user will select the word "ciao" from the dropdown menu then hide that row (row 1)
    if in A2 the user will select the word "ciao" from the dropdown menu then hide that row (row 2)
    ....
    If in A20 the user will select the word "ciao" from the dropdown menu then hide that row (row 20)


    Thank you

  • try this (in sheet module)

    Code
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub
    If Intersect(Target, Range("A1:A20")) Is Nothing Then Exit Sub
    Target.EntireRow.Hidden = Target.Value = "ciao"
    End Sub
  • Thank you so much. It definetely works but I'm experiencing one problem.
    The word "ciao" don't comes from a from a drop down list but is the result from a IF Formula.


    Can you help me please?

  • try

    Code
    Private Sub Worksheet_Calculate()
    Dim r As Range
    For Each r In Range("A1:A20")
        r.EntireRow.Hidden = r.Value = "ciao"
    Next
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!