![]() |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 10:29 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com