ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Conditional Hide rows with zero (https://www.excelbanter.com/excel-programming/316398-conditional-hide-rows-zero.html)

Vlookup help

Conditional Hide rows with zero
 
Hi,

I would like a VBA code that will allow me to hide certain rows. That is,
if cell A3 has a "1" in it, then I want that entire row (only on this
worksheet, not throughout the workbook) to be hidden. I would also like it
to hide all of the totally blank rows at the bottom of the worksheet. The
last request is that this is a constantly running and as each cell in column
A changes to a "1" then the row is hidden.

Thanks,

Jon

Gord Dibben

Conditional Hide rows with zero
 
Jon

Worksheet event code........

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
n = Target.Row
If Excel.Range("A" & n).Value = 1 Then
Excel.Range("A" & n).EntireRow.Hidden = True
End If
End If
enditall:
Application.EnableEvents = True
End Sub

Gord Dibben Excel MVP

On Wed, 10 Nov 2004 17:09:02 -0800, Vlookup help
wrote:

Hi,

I would like a VBA code that will allow me to hide certain rows. That is,
if cell A3 has a "1" in it, then I want that entire row (only on this
worksheet, not throughout the workbook) to be hidden. I would also like it
to hide all of the totally blank rows at the bottom of the worksheet. The
last request is that this is a constantly running and as each cell in column
A changes to a "1" then the row is hidden.

Thanks,

Jon



kdreyer

Conditional Hide rows with zero
 
This is what I use:

For I = 1 To 800
Range("A" & I).Select
If ActiveCell.Value = "0" Then
Selection.EntireRow.Hidden = True
Else
End If

Next I




"Vlookup help" wrote:

Hi,

I would like a VBA code that will allow me to hide certain rows. That is,
if cell A3 has a "1" in it, then I want that entire row (only on this
worksheet, not throughout the workbook) to be hidden. I would also like it
to hide all of the totally blank rows at the bottom of the worksheet. The
last request is that this is a constantly running and as each cell in column
A changes to a "1" then the row is hidden.

Thanks,

Jon



All times are GMT +1. The time now is 05:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com