Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default How can i hide a row or delete

Is there a way i can hide or delete a whole row if the sum of the cell is = 0
example if A5=0 delete or hide the whole row. Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default How can i hide a row or delete

If A5 is zero then this will hide row 5

Private Sub Worksheet_Change(ByVal Target As Range)
If Cells(5, 1).Value = 0 Then
Rows("5:5").Select
Selection.EntireRow.Hidden = True
End If
End Sub

"algebroni" wrote:

Is there a way i can hide or delete a whole row if the sum of the cell is = 0
example if A5=0 delete or hide the whole row. Thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default How can i hide a row or delete

Sorry it's O5 not A5 and is there a function that can do that

"Mike" wrote:

If A5 is zero then this will hide row 5

Private Sub Worksheet_Change(ByVal Target As Range)
If Cells(5, 1).Value = 0 Then
Rows("5:5").Select
Selection.EntireRow.Hidden = True
End If
End Sub

"algebroni" wrote:

Is there a way i can hide or delete a whole row if the sum of the cell is = 0
example if A5=0 delete or hide the whole row. Thanks

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default How can i hide a row or delete

5,15 instead of 5,1

"algebroni" wrote:

Sorry it's O5 not A5 and is there a function that can do that

"Mike" wrote:

If A5 is zero then this will hide row 5

Private Sub Worksheet_Change(ByVal Target As Range)
If Cells(5, 1).Value = 0 Then
Rows("5:5").Select
Selection.EntireRow.Hidden = True
End If
End Sub

"algebroni" wrote:

Is there a way i can hide or delete a whole row if the sum of the cell is = 0
example if A5=0 delete or hide the whole row. Thanks

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default How can i hide a row or delete

Functions can only return values, not make formatting changes.

Is the value in O5 the result of a formula in O5?

Change event code is not triggered by a formula-generated value being changed.

Only triggered when you actually Enter something in the cell.

Try this if a formula-generated value in O5

Private Sub Worksheet_Calculate()
On Error GoTo endit
Application.EnableEvents = False
With Me.Range("O5")
If (.Value) = 0 Then
.EntireRow.Hidden = True
Else: .EntireRow.Hidden = False
End If
End With
endit:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on your sheet tab and "View Code".

Copy/paste into that sheet module.



Gord Dibben MS Excel MVP

On Fri, 9 Feb 2007 12:01:01 -0800, algebroni
wrote:

Sorry it's O5 not A5 and is there a function that can do that

"Mike" wrote:

If A5 is zero then this will hide row 5

Private Sub Worksheet_Change(ByVal Target As Range)
If Cells(5, 1).Value = 0 Then
Rows("5:5").Select
Selection.EntireRow.Hidden = True
End If
End Sub

"algebroni" wrote:

Is there a way i can hide or delete a whole row if the sum of the cell is = 0
example if A5=0 delete or hide the whole row. Thanks


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 of cells that are blank dford Excel Discussion (Misc queries) 9 February 4th 07 11:35 PM
I can't delete an image in excel workbook [email protected] Excel Discussion (Misc queries) 6 October 13th 06 06:41 PM
How to Delete Rows in Excel In a Do Loop indraneel Excel Worksheet Functions 6 September 15th 06 09:51 AM
I can't delete a cell without deleting a row Tenny Excel Discussion (Misc queries) 2 June 30th 06 12:52 AM
How do I delete columns and rows in Excel, not just hide them Eddie Excel Discussion (Misc queries) 2 November 23rd 05 05:11 PM


All times are GMT +1. The time now is 06:43 PM.

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"