Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Hide rows that doesn't match cell

Here is the example:
Kelly John Tulsa & Stillwater OK

I have a range of 10 states, 20 states, another 20 states for 3 different
people.

If state matches in the range of the 10 states, then all other rows are
hidden..thought it was as basic as,
Dim R As Range
For Each R In Range("E:E")
If R.Value = ("L:L") Then Rows(R.Row).Hidden = True
Next
End Sub

or

Dim cell As Range
'For Each cell In Range("L:L")
'If UCase(cell.Value) = "IA" Then
'cell.EntireRow.Hidden = True
'End If
'Next

I'm out of ideas.

Thanks in advance


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Hide rows that doesn't match cell

try

Dim R As Range
For Each R In Range("E:E")
If R.Value = range("L" & r.row) Then Rows(R.Row).Hidden = True
Next
End Sub

you can't just specify (AFAIK) the whole range of L:L, you have to
tell it specifically which cell to compare it to.
if i understood you correctly.
:)
susan


On Nov 19, 11:21*pm, Getting Fired
wrote:
Here is the example:
Kelly * John * *Tulsa & Stillwater *OK

I have a range of 10 states, 20 states, another 20 states for 3 different
people.

If state matches in the range of the 10 states, then all other rows are
hidden..thought it was as basic as,
Dim R As Range
* For Each R In Range("E:E")
* * If R.Value = ("L:L") Then Rows(R.Row).Hidden = True
* Next
End Sub

or

Dim cell As Range
'For Each cell In Range("L:L")
'If UCase(cell.Value) = "IA" Then
'cell.EntireRow.Hidden = True
'End If
'Next

I'm out of ideas.

Thanks in advance


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Hide rows that doesn't match cell

Susan:

Thanks for the quick response...I have this but it just keeps looping
now...from L7:L19 I have the abbreviations to each state in the 10 state
range....

Do I have to put this code in for all 10 per cell?

I appreciate the help...what is AFAIK?

"Susan" wrote:

try

Dim R As Range
For Each R In Range("E:E")
If R.Value = range("L" & r.row) Then Rows(R.Row).Hidden = True
Next
End Sub

you can't just specify (AFAIK) the whole range of L:L, you have to
tell it specifically which cell to compare it to.
if i understood you correctly.
:)
susan


On Nov 19, 11:21 pm, Getting Fired
wrote:
Here is the example:
Kelly John Tulsa & Stillwater OK

I have a range of 10 states, 20 states, another 20 states for 3 different
people.

If state matches in the range of the 10 states, then all other rows are
hidden..thought it was as basic as,
Dim R As Range
For Each R In Range("E:E")
If R.Value = ("L:L") Then Rows(R.Row).Hidden = True
Next
End Sub

or

Dim cell As Range
'For Each cell In Range("L:L")
'If UCase(cell.Value) = "IA" Then
'cell.EntireRow.Hidden = True
'End If
'Next

I'm out of ideas.

Thanks in advance



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Hide rows that doesn't match cell

:) As Far As I Know AFAIK

i don't know if i'm understanding you completely, but you seem to be
saying that if the state name in column E in each row also exists in
the range of L7 - L19, then hide the row. if it doesn't exist in that
range, then keep it visible. is that right?

if so, then try this (not tested):


Dim R As Range
dim myRange as range
dim c as range

set myRange = range("L7:L19")

For Each R In Range("E:E")
For each c in MyRange
If R.Value = c.value Then Rows(R.Row).Hidden = True
next c
next r

End Sub


i think that works.
:)
susan


On Nov 20, 10:23*am, Getting Fired
wrote:
Susan:

Thanks for the quick response...I have this but it just keeps looping
now...from L7:L19 I have the abbreviations to each state in the 10 state
range....

Do I have to put this code in for all 10 per cell?

I appreciate the help...what is AFAIK?



"Susan" wrote:
try


Dim R As Range
* For Each R In Range("E:E")
* * If R.Value = range("L" & r.row) Then Rows(R.Row).Hidden = True
* Next
End Sub


you can't just specify (AFAIK) the whole range of L:L, you have to
tell it specifically which cell to compare it to.
if i understood you correctly.
:)
susan


On Nov 19, 11:21 pm, Getting Fired
wrote:
Here is the example:
Kelly * John * *Tulsa & Stillwater *OK


I have a range of 10 states, 20 states, another 20 states for 3 different
people.


If state matches in the range of the 10 states, then all other rows are
hidden..thought it was as basic as,
Dim R As Range
* For Each R In Range("E:E")
* * If R.Value = ("L:L") Then Rows(R.Row).Hidden = True
* Next
End Sub


or


Dim cell As Range
'For Each cell In Range("L:L")
'If UCase(cell.Value) = "IA" Then
'cell.EntireRow.Hidden = True
'End If
'Next


I'm out of ideas.


Thanks in advance- Hide quoted text -


- Show quoted text -


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Hide rows that doesn't match cell

Your my HERO!!!!

Thank you very much!!!

"Susan" wrote:

:) As Far As I Know AFAIK

i don't know if i'm understanding you completely, but you seem to be
saying that if the state name in column E in each row also exists in
the range of L7 - L19, then hide the row. if it doesn't exist in that
range, then keep it visible. is that right?

if so, then try this (not tested):


Dim R As Range
dim myRange as range
dim c as range

set myRange = range("L7:L19")

For Each R In Range("E:E")
For each c in MyRange
If R.Value = c.value Then Rows(R.Row).Hidden = True
next c
next r

End Sub


i think that works.
:)
susan


On Nov 20, 10:23 am, Getting Fired
wrote:
Susan:

Thanks for the quick response...I have this but it just keeps looping
now...from L7:L19 I have the abbreviations to each state in the 10 state
range....

Do I have to put this code in for all 10 per cell?

I appreciate the help...what is AFAIK?



"Susan" wrote:
try


Dim R As Range
For Each R In Range("E:E")
If R.Value = range("L" & r.row) Then Rows(R.Row).Hidden = True
Next
End Sub


you can't just specify (AFAIK) the whole range of L:L, you have to
tell it specifically which cell to compare it to.
if i understood you correctly.
:)
susan


On Nov 19, 11:21 pm, Getting Fired
wrote:
Here is the example:
Kelly John Tulsa & Stillwater OK


I have a range of 10 states, 20 states, another 20 states for 3 different
people.


If state matches in the range of the 10 states, then all other rows are
hidden..thought it was as basic as,
Dim R As Range
For Each R In Range("E:E")
If R.Value = ("L:L") Then Rows(R.Row).Hidden = True
Next
End Sub


or


Dim cell As Range
'For Each cell In Range("L:L")
'If UCase(cell.Value) = "IA" Then
'cell.EntireRow.Hidden = True
'End If
'Next


I'm out of ideas.


Thanks in advance- Hide quoted text -


- Show quoted text -





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Hide rows that doesn't match cell

well, i'm glad it worked!
:D
susan


On Nov 20, 10:24*pm, Getting Fired
wrote:
Your my HERO!!!!

Thank you very much!!!



"Susan" wrote:
:) *As Far As I Know *AFAIK


i don't know if i'm understanding you completely, but you seem to be
saying that if the state name in column E in each row also exists in
the range of L7 - L19, then hide the row. *if it doesn't exist in that
range, then keep it visible. *is that right?


if so, then try this (not tested):


Dim R As Range
dim myRange as range
dim c as range


set myRange = range("L7:L19")


* For Each R In Range("E:E")
* * * *For each c in MyRange
* * * * * * * If R.Value = c.value Then Rows(R.Row).Hidden = True
* * * *next c
next r


End Sub


i think that works.
:)
susan


On Nov 20, 10:23 am, Getting Fired
wrote:
Susan:


Thanks for the quick response...I have this but it just keeps looping
now...from L7:L19 I have the abbreviations to each state in the 10 state
range....


Do I have to put this code in for all 10 per cell?


I appreciate the help...what is AFAIK?


"Susan" wrote:
try


Dim R As Range
* For Each R In Range("E:E")
* * If R.Value = range("L" & r.row) Then Rows(R.Row).Hidden = True
* Next
End Sub


you can't just specify (AFAIK) the whole range of L:L, you have to
tell it specifically which cell to compare it to.
if i understood you correctly.
:)
susan


On Nov 19, 11:21 pm, Getting Fired
wrote:
Here is the example:
Kelly * John * *Tulsa & Stillwater *OK


I have a range of 10 states, 20 states, another 20 states for 3 different
people.


If state matches in the range of the 10 states, then all other rows are
hidden..thought it was as basic as,
Dim R As Range
* For Each R In Range("E:E")
* * If R.Value = ("L:L") Then Rows(R.Row).Hidden = True
* Next
End Sub


or


Dim cell As Range
'For Each cell In Range("L:L")
'If UCase(cell.Value) = "IA" Then
'cell.EntireRow.Hidden = True
'End If
'Next


I'm out of ideas.


Thanks in advance- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


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
Populate combo box, then hide rows that don't match chosen value Finny Excel Programming 1 June 8th 08 12:51 AM
auto-hide rows, cell format (# and @), update cell refs, shade cel Mo2 Excel Discussion (Misc queries) 0 April 17th 07 03:44 AM
Hide Rows if cell value is mohd21uk via OfficeKB.com New Users to Excel 1 May 16th 06 03:23 PM
hide rows when the cell is #VALUE! barkiny Excel Worksheet Functions 1 March 10th 06 03:06 PM
hide rows if cell=0 Paiolas Excel Programming 2 September 8th 03 07:14 PM


All times are GMT +1. The time now is 03:49 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"