Thread: auto hide
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Nyatiaju Nyatiaju is offline
external usenet poster
 
Posts: 3
Default auto hide

On Jan 30, 11:26*am, Chad wrote:
Is there a way to auto hide a row based on the contents of a certain column
in the row?

For Example:
Auto hide any row where column A has a - for the value of the cell.

I believe value is the right term here because the reason I ask the cell
will contain a formula that may result in a - if so I want the row hidden..


Hi,

You can have control in place like textbox which can be linked to the
cell (e.g. A1). To link use textbox property "Linkedcell" and below
textbox event will do the rest.

Example:

Private Sub TextBox1_Change()
Select Case TextBox1.Value
Case 1
Range("a2:a5").EntireRow.Hidden = True
Range("a6:a10").EntireRow.Hidden = False
Range("a11:a15").EntireRow.Hidden = False
Case 2
Range("a6:a10").EntireRow.Hidden = True
Range("a2:a5").EntireRow.Hidden = False
Range("a11:a15").EntireRow.Hidden = False
Case 3
Range("a11:a15").EntireRow.Hidden = True
Range("a2:a5").EntireRow.Hidden = False
Range("a6:a10").EntireRow.Hidden = False
Case Else
Range("a2:a5").EntireRow.Hidden = False
Range("a6:a10").EntireRow.Hidden = False
Range("a11:a15").EntireRow.Hidden = False
End Select
End Sub