How do I automatically hide rows

R

RobRoy

I wish to be able to automatically hide a row when data is entered into a
cell in that row.
Any ideas?

Roy
 
D

Don Guillett

right click sheet tab>view code>copy/paste this>SAVE
Now when you enter anything in any cell in rows (below row 4), the row hides

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row > 4 Then Rows(Target.Row).Hidden = True
End Sub
 
G

Gord Dibben

Roy

This would require worksheet event code.

Several options to consider......

Any cell in any row?
A specific cell in any row?
Any cell in a specific row?
A specific cell in a specific row?

Row(s) to remain hidden until you manually unhide?


Gord Dibben Excel MVP
 
R

RobRoy

Thanks Don.

How would I make the row hidden by entering data in a specific cell.

Roy
 
D

Don Guillett

specific cell????? Do you mean a specific column within the row?? If so,
which one???
 
R

RobRoy

Yes, for instance if I enter data into A2 then row 2 would br hidden but not
if I enter data into B2 etc.
 
J

Jay

Yes, for instance if I enter data into A2 then row 2 would br hidden
but not if I enter data into B2 etc.

I've used AutoFilter for this.

Select column A and use
Data >> Filter >> AutoFilter
This adds a pull-down arrow at A1 and lets you show rows with blanks in
column A (for example). After making a change in column A, click the pull-
down arrow again.

By the way, is there something as easy as this for columns rather than
rows? I saw a posting that suggested a macro, but I'd prefer something like
AutoFilter.
 
D

Don Guillett

If you want for column B then modify my macro to
If Target.Row > 4 and target.column=2 Then Rows(Target.Row).Hidden = True
 
Top