# SOLVED!HIDE ROWS IF CERTAIN CELLS BLANK

#### ROBINSYN

##### Board Regular
IS THERE A WAY I CAN ASSIGN A MACRO TO HIDE CERTAIN ROWS IF FOR EXAMPLE E2,E3,E4'E5 ARE =0. AND ANOTHER MACRO TO ONHIDE ALL ROWS.

ANY HELP APPRECIATED
This message was edited by ROBINSYN on 2002-10-27 18:13

### Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
try these out:
Code:
``````Sub Hide_Rows()
Application.ScreenUpdating = False
If [E2].Value = 0 Then Rows("2").EntireRow.Hidden = True
If [E3].Value = 0 Then Rows("3").EntireRow.Hidden = True
If [E4].Value = 0 Then Rows("4").EntireRow.Hidden = True
If [E5].Value = 0 Then Rows("5").EntireRow.Hidden = True
Application.ScreenUpdating = False
End Sub``````

Code:
``````Sub Unhide_Rows
Rows("2:5").EntireRow.Hidden = False
End Sub``````

HTH
kevin

How about autofiltering E1:E5 for blanks ?

good point Juan Pablo

Robin, you could also make this into a macro:

Sub Hide_Me()
[E2:E5].AutoFilter Field:=1, Criteria1:="<>0"
End Sub

and assign it to a command button. the macro to unfilter it would be:

Sub Unhide_Me()
[E2:E5].AutoFilter Field:=1
End Sub

kevin

Replies
8
Views
503
Replies
4
Views
686
Replies
6
Views
304
Replies
3
Views
737
Replies
3
Views
122

1,220,980
Messages
6,157,187
Members
451,404
Latest member
Probe

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back