Solved

Modify code so that when designated cells contain an "X", the row below will be unhidden

Posted on 2011-02-20
3
300 Views
Last Modified: 2012-05-11
Code below works, but how can it be modified to accomodate "X" in the following cells and row immediately below is unhidden:  I15, I17, I20, J23, J25, J30 & J32?

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range

Set rng = Me.Cells(13, "I")

If Not Intersect(rng, Target) Is Nothing Then
    If UCase(Target.Value) = "X" Then
        Rows("9:11").EntireRow.Hidden = False
    End If
End If

End Sub
0
Comment
Question by:klitton7
3 Comments
 
LVL 41

Accepted Solution

by:
dlmille earned 500 total points
ID: 34947177
Just tested - this should work correctly for you:
 
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range

    Set rng = Range("I15,I17,I20,J23,J25,J30,J32") 'range to check for changes
    
    If Not Intersect(Target, rng) Is Nothing Then
        If UCase(Target.Value) = "X" Then
            Target.Offset(1, 0).EntireRow.Hidden = False 'unhide row immediately beneath where X was just typed
        End If
    End If

End Sub

Open in new window


Enjoy!

Dvae
0
 

Author Closing Comment

by:klitton7
ID: 34947206
Thank you very much!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now