View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Nicole[_2_] Nicole[_2_] is offline
external usenet poster
 
Posts: 8
Default automate hide row

On Dec 18, 4:51*pm, Socko wrote:
If you are gonna be sure that the cell value will be a constant (not
formula) then, use the following procedure in the given sheet module,
and save the workbook.

* * * * Private Sub Worksheet_Change(ByVal Target As Range)
* * * * If Target.Column = 1 Then
* * * * * If Target.Value = 0 Then
* * * * * * Target.EntireRow.Hidden = True
* * * * * End If
* * * * End If
* * * * End Sub

You may try using the following module if the result 0 will be due to
formula, and not constant.

* * * * Private Sub Worksheet_Calculate()
* * * * For i = 1 To ThisWorkbook.Sheets(Sheet1).UsedRange.Rows..Count
* * * * * If Cells(i, 1).Value = 0 Then
* * * * * * Cells(i, 1).EntireRow.Hidden = True
* * * * * Else
* * * * * * Cells(i, 1).EntireRow.Hidden = False
* * * * * End If
* * * * Next i
* * * * End Sub

I hope this helps.

Selva V Pasupathy
For more on Excel, VBA, & other resources
Please visithttp://socko.wordpress.com/


Hi Socko,
I have copied and paste the Calculate section into the view code and
save, nothing seem to happen, those rows with the blank cell on column
P still there.