if cell = 0 then hide the row?
Typo, should be
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "F3:F66536"
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value = 0 Then
.EntireRow.Hidden = True
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
--
HTH
Bob Phillips
(remove nothere from email address if mailing direct)
"Bob Phillips" wrote in message
...
Here is one way which assumes headings in rows 1 and 2. Just chan ge the
F3
to the first real data row.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "F3:F88536"
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value = 0 Then
.EntireRow.Hidden = True
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
--
HTH
Bob Phillips
(remove nothere from email address if mailing direct)
"Al" wrote in message
...
My spreadsheet is a list of names and hours and charges, but if name X,
say
D14, has zero hours, say F14 = 0, then I do not need the row -
otherwise
my
spreadsheet will have so many unused rows - and so want to hide it.
To complicate matters, my spreadsheet has titles, etc, and clearly such
a
row has no value for hours in any cell, and these rows are not to be
hidden.
I see something that only conisders the "data rows" and hides them if
the
hours cell, F14, is zero.
Allan
|