Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default unhiding and hiding rows

I would like to see only those rows which value matches with master cell. for
example, if C5=P, I want to see only those rows which has value of P or C.
Similary, if the value C5=L, then I want to see only those rows which has
value of L and C. Category C is common rows. So, I need to see them no matter
what is in C5. Thanks in advance for your help.


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default unhiding and hiding rows

How will C5 get changed from P to L?

What column or columns would the P's C's and L's be located?

This macro will hide all rows then unhide according to value in C5.

I used column D as the column in which the letters will be found.

Tweak as necessary.

Sub hide_rows()
Dim RowNdx As Long
Dim LastRow As Long
ActiveSheet.Rows.Hidden = True
LastRow = ActiveSheet.UsedRange.Rows.Count
For RowNdx = LastRow To 1 Step -1
If Range("C5").Value = "L" And _
Cells(RowNdx, "D").Value = "L" Or _
Cells(RowNdx, "D").Value = "C" Then
Rows(RowNdx).Hidden = False
ElseIf Range("C5").Value = "P" And _
Cells(RowNdx, "D").Value = "P" Or _
Cells(RowNdx, "D").Value = "C" Then
Rows(RowNdx).Hidden = False
End If
Next RowNdx
End Sub


Gord Dibben MS Excel MVP

On Wed, 5 Mar 2008 09:35:02 -0800, Paul_of_Abingdon
wrote:

I would like to see only those rows which value matches with master cell. for
example, if C5=P, I want to see only those rows which has value of P or C.
Similary, if the value C5=L, then I want to see only those rows which has
value of L and C. Category C is common rows. So, I need to see them no matter
what is in C5. Thanks in advance for your help.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default unhiding and hiding rows

I have modified the spread sheet. It looks like this:
1. Top few rows are header.
2. C5 has drop down list to choose the category. Three selections, P, L and X.
3. Column D is used to mark category. Some rows in beginning and some rows
at the end are common rows which are applicable for all category. So, they
don't have any marking. Only rows in the middle section (i.e., from D41 to
D140) of the spreadsheet have marking of P, L or X. What I really want is an
option to be able to hide rows in the middle which does not match the value
in C5. In another word, if C5 value is changed to P, I want to hide all rows
which are marked L or X, automatically. Similary, if C5 is changed to L, I
wan to hide all rows with P and X marking. But if the C5 value is blank, I
would like to see all rows.







"Gord Dibben" wrote:

How will C5 get changed from P to L?

What column or columns would the P's C's and L's be located?

This macro will hide all rows then unhide according to value in C5.

I used column D as the column in which the letters will be found.

Tweak as necessary.

Sub hide_rows()
Dim RowNdx As Long
Dim LastRow As Long
ActiveSheet.Rows.Hidden = True
LastRow = ActiveSheet.UsedRange.Rows.Count
For RowNdx = LastRow To 1 Step -1
If Range("C5").Value = "L" And _
Cells(RowNdx, "D").Value = "L" Or _
Cells(RowNdx, "D").Value = "C" Then
Rows(RowNdx).Hidden = False
ElseIf Range("C5").Value = "P" And _
Cells(RowNdx, "D").Value = "P" Or _
Cells(RowNdx, "D").Value = "C" Then
Rows(RowNdx).Hidden = False
End If
Next RowNdx
End Sub


Gord Dibben MS Excel MVP

On Wed, 5 Mar 2008 09:35:02 -0800, Paul_of_Abingdon
wrote:

I would like to see only those rows which value matches with master cell. for
example, if C5=P, I want to see only those rows which has value of P or C.
Similary, if the value C5=L, then I want to see only those rows which has
value of L and C. Category C is common rows. So, I need to see them no matter
what is in C5. Thanks in advance for your help.



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
Hiding/unhiding rows Matheus Excel Discussion (Misc queries) 2 November 11th 07 11:20 PM
Hiding and unhiding pictures Garyw Excel Discussion (Misc queries) 3 April 30th 07 06:18 PM
Hiding/Unhiding Columns Karen McKenzie Excel Worksheet Functions 3 August 10th 06 11:49 AM
hiding/unhiding rows & columns with "+" and "-" buttons shellshock Excel Discussion (Misc queries) 2 August 3rd 05 05:22 AM
Hiding/Unhiding Bobby Excel Worksheet Functions 2 May 25th 05 10:40 PM


All times are GMT +1. The time now is 04:47 PM.

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

About Us

"It's about Microsoft Excel"