Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 460
Default Macro to hide rows

What is a good macro to hide rows in a table selected range that have "0"
values?
Reason for wanting this if I filter any one column for values of "0" then it
is likely to hide values in other columns that are not "0". I want to show
all rows that have any value other than "0" in a selected range. Can you help
me please?
--
Thank you!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Macro to hide rows

Doug,

Try this. Select a range and then run the code

Sub Hide_Me()
For Each c In Selection
If c.Value < "" And c.Value = 0 Then
c.EntireRow.Hidden = True
End If
Next
End Sub

Mike

"Doug" wrote:

What is a good macro to hide rows in a table selected range that have "0"
values?
Reason for wanting this if I filter any one column for values of "0" then it
is likely to hide values in other columns that are not "0". I want to show
all rows that have any value other than "0" in a selected range. Can you help
me please?
--
Thank you!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 460
Default Macro to hide rows

I think this is hiding a row if it has a single "0" value. I am needing it to
hide it if they are all "0" values. When I tried it, ran for about 1 minute
and timed out after hiding about 40 rows at the top of my table.
--
Thank you!


"Mike H" wrote:

Doug,

Try this. Select a range and then run the code

Sub Hide_Me()
For Each c In Selection
If c.Value < "" And c.Value = 0 Then
c.EntireRow.Hidden = True
End If
Next
End Sub

Mike

"Doug" wrote:

What is a good macro to hide rows in a table selected range that have "0"
values?
Reason for wanting this if I filter any one column for values of "0" then it
is likely to hide values in other columns that are not "0". I want to show
all rows that have any value other than "0" in a selected range. Can you help
me please?
--
Thank you!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Macro to hide rows

How about, instead of code, add a column with formula that resolves to True
if your condition is met, then just apply a filter?

e.g. new column A, with formula in A2 "=or(b2<0,c2<0,d2<0,e2<0)" with
arguments for as many cells to the right need to be tested for 0 value.

"Doug" wrote:

What is a good macro to hide rows in a table selected range that have "0"
values?
Reason for wanting this if I filter any one column for values of "0" then it
is likely to hide values in other columns that are not "0". I want to show
all rows that have any value other than "0" in a selected range. Can you help
me please?
--
Thank you!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 460
Default Macro to hide rows

Thank you
--
Thank you!


"B Lynn B" wrote:

How about, instead of code, add a column with formula that resolves to True
if your condition is met, then just apply a filter?

e.g. new column A, with formula in A2 "=or(b2<0,c2<0,d2<0,e2<0)" with
arguments for as many cells to the right need to be tested for 0 value.

"Doug" wrote:

What is a good macro to hide rows in a table selected range that have "0"
values?
Reason for wanting this if I filter any one column for values of "0" then it
is likely to hide values in other columns that are not "0". I want to show
all rows that have any value other than "0" in a selected range. Can you help
me please?
--
Thank you!

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
Macro code to hide rows and not calculate hidden rows bradmcq Excel Discussion (Misc queries) 0 September 1st 09 12:38 AM
Macro to hide rows lightbulb Excel Discussion (Misc queries) 4 July 11th 08 06:13 PM
Macro to hide rows? Cam Excel Programming 1 April 22nd 08 07:23 PM
Hide rows with macro Fugazy[_2_] Excel Programming 4 June 7th 06 03:37 PM
Macro to hide rows Alex Excel Programming 1 November 7th 05 07:09 PM


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