?
Solved

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

Posted on 2011-02-20
3
Medium Priority
?
347 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 2000 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

762 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