How to Hide/Unhide Rows

< Back to Search results

 Category: [Excel]  Demo Available 

How to Hide/Unhide Rows




In cell A1 to A20 I have a drop down list menu with 2 options: "ciao" and "bye"


The user is trying to hide a row (1 to 20 in this case), when in cell A1 to A20 there is the word "ciao".


The user also need that the same row is unhide (so displayed) when there is a word different from "ciao".

The user needs to run this MACRO continuosly and not by clicking "run".




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


Obtained from the OzGrid Help Forum.

Solution provided by nilem.


See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets


See also:

How to use VBA code to hide row based on month
How to hide/unhide specific name range using VBA
How do I hide data in column until data is entered in columns to the left
How to Delete/Hide every nth row


Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.


stars (0 Reviews)