Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10
Default hiding a row in a spreadsheet if calculated value = 0

Hello,
I am working on invoices for my employer. Each row in the spreadsheet has a
calculated value. When the calculated value in the row = 0, then I am to
'hide' the row. If the calculated value is not =0, (could be positive or
negative), then I am to display or 'unhide' the row. Does anyone know how to
do this? Macros and VBA responses are ok. :)
--
Thank you,
Electricbluelady
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 5,441
Default hiding a row in a spreadsheet if calculated value = 0

Electricbluelady,

Select the cells with the values (including the header row), then use Data / Filters....
AutoFilter. Select the dropdown on the header cell, then choose Custom, Does Not Equal, and enter a
0 into the right hand box. Press OK and you are done.

HTH,
Bernie
MS Excel MVP


"electricbluelady" wrote in message
...
Hello,
I am working on invoices for my employer. Each row in the spreadsheet has a
calculated value. When the calculated value in the row = 0, then I am to
'hide' the row. If the calculated value is not =0, (could be positive or
negative), then I am to display or 'unhide' the row. Does anyone know how to
do this? Macros and VBA responses are ok. :)
--
Thank you,
Electricbluelady



  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1,388
Default hiding a row in a spreadsheet if calculated value = 0

Hi,
Try this macro:

Sub HideZeros()
A = 1 'Start Row
B = 1 'Calculated Value Column
C = 1 'Any Column which has text data in each row
Do Until Cells(A, C) = ""
If Cells(A, B).Value = 0 Then Rows(A).EntireRow.Hidden = True
A = A + 1
Loop
End Sub

You will have to change the values of A, B, C to suit your data.
A is your first Row of data (Row number)
B is the Column Number of your calculated value. This needs to be a number,
not a letter. eg, enter 5 for Column E
C is any column that has text for every row of your data. The macro
continuously checks this column for data. When it finds a blank, it will
stop. As above, enter the Column number, not the letter.

This macro just runs once, hiding rows with zero in the critical cell. If
you want a row to hide as soon as its critical cell becomes zero, then you
need an event macro, which can also be done.

Regards - Dave.
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 files in the same spreadsheet Mike Excel Discussion (Misc queries) 2 January 5th 07 01:45 AM
pivot table formulas for calculated field or calculated item Vicky Excel Discussion (Misc queries) 3 June 6th 06 05:06 AM
Calculated Link to Another Spreadsheet DCSwearingen Excel Discussion (Misc queries) 0 April 3rd 06 08:21 PM
User form and hiding spreadsheet Chip Smith Excel Discussion (Misc queries) 0 March 29th 06 07:46 PM
PIVOT TABLE - hiding records with CALCULATED item values equal to Pele Excel Discussion (Misc queries) 0 March 10th 06 04:15 PM


All times are GMT +1. The time now is 06:51 AM.

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"