Solved

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

Posted on 2011-02-20
3
340 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 42

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

To Patch or not to Patch? That is the question!

Don't get caught out like thousands of others around the world in the recent Ransomware Fiasco!
Discuss..
- Why it's not a good idea to wait before Patching
- Sensible approaches to Patching discussed
- Add your feedback, comments and suggestions

Question has a verified solution.

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

Suggested Solutions

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…
Outlook Free & Paid Tools
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

739 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