Solved

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

Posted on 2011-02-20
3
324 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

816 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

8 Experts available now in Live!

Get 1:1 Help Now