Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / April 2008

Tip: Looking for answers? Try searching our database.

Hide Rows Based on Cell Result

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BJ - 14 Apr 2008 22:38 GMT
Hi All

Having difficulty and full disclosure - ** VB Newbie **

I would like to hide rows e.g., 20-25, 51 and 80-90 if the value in cell L15
= "Additional" and expose these same rows if the value in cell L15 = "Final"

Cell L15 is set up using Data | Validation | List | Additional,Final

Any help is appreciated greatly.

Brett
Dave Peterson - 14 Apr 2008 23:30 GMT
Rightclick on the worksheet tab that should have this behavior.  Select View
code and paste this into the code window that just opened.

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
   If Target.Cells.Count > 1 Then Exit Sub
   If Intersect(Target, Me.Range("L15")) Is Nothing Then
       Exit Sub
   End If
   
   Me.Range("20:25,51:51,80:90").EntireRow.Hidden _
       = CBool(LCase(Target.Value) <> LCase("final"))
   
End Sub

It actually shows the rows if that cell is "final".  Anything else (blank, too!)
and the rows are hidden.

> Hi All
>
[quoted text clipped - 8 lines]
>
> Brett

Signature

Dave Peterson

BJ - 14 Apr 2008 23:41 GMT
Mr. Peterson you rule!  Thanks so much.

> Rightclick on the worksheet tab that should have this behavior.  Select View
> code and paste this into the code window that just opened.
[quoted text clipped - 26 lines]
> >
> > Brett
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.