View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Automatically Hide Rows

Tracy,

Slow down and read the advice I gave you, here it is again.

Right click your sheet tab, in the popup click on 'View code' and paste the
code in on the right. You still haven't told me which cell a 'certain cell'
is so this works on column D.

If Not Intersect(Target, Range("D:D")) Is Nothing Then

Change the D:D to whatver column you want F:F for column F for example.
I changed the code to work with 0 & 1.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("D:D")) Is Nothing Then
If IsNumeric(Target) And Target.Value = O _
Or Target.Value = 1 Then
Target.EntireRow.Hidden = True
End If
End If
End Sub



Mike


"Tracy" wrote:

Hi Mike, I tried that, but it didn't seem to work. The row needs to
disappear if there is a 0 in a certain cell. There are only two choices a
"0" or a "1". I can change those numbers to 1/2 or 3/4 if that helps.
Also when I paste the information does it need to be on Worksheet at the top
or anything else I may be missing?
--
Tracy


"Mike H" wrote:

Hi,

Not with a format but you can do it with event code like this. Right click
your sheet tab, view code and paste the code below in. As soon as a value
10 is entered in column D then the row is hidden.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("D:D")) Is Nothing Then
If IsNumeric(Target) And Target.Value 10 Then
Target.EntireRow.Hidden = True
End If
End If
End Sub

Mike

"Tracy" wrote:

Is there a way to format a worksheet to automatically hide rows if a certain
cell = a certain number?
--
Tracy