Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Hide Rows Based on Cell Result

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Hide Rows Based on Cell Result

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.



BJ wrote:

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
BJ BJ is offline
external usenet poster
 
Posts: 51
Default Hide Rows Based on Cell Result

Mr. Peterson you rule! Thanks so much.

"Dave Peterson" wrote:

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.



BJ wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
hide rows based on cell value dummster New Users to Excel 1 February 15th 06 11:37 PM
hide rows based on value in cell dummster Excel Discussion (Misc queries) 0 February 15th 06 03:27 PM
Macro to hide rows based on a zero value in a particular cell Peter Excel Programming 2 July 29th 04 03:19 AM
How to Hide Rows based on conditional value in cell Nick Excel Programming 1 May 21st 04 11:16 AM
Code to hide rows based on cell contents Tim[_29_] Excel Programming 5 December 17th 03 02:59 PM


All times are GMT +1. The time now is 09:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"