Hide Rows based on multiple cells

GinoZ

Board Regular
Joined
Feb 6, 2006
Messages
169
Hey Guys,

different question than I had this morning. I have a specific range (B11:D57). I want to run a macro that hides a row if ALL cells in B,C and D are empty. Most of them have an IF formula in them that does ''" if the criteria is not met. Best thing I found was the following but it also didn't help/


Code:
Public Sub Hiderows() 
Dim LRow As Integer 
Dim i As Integer 
LRow = Cells(Rows.Count, 1).End(xlUp).Row 
For i = 1 To LRow 
    If Cells(i, "C") = 0 And Cells(i, "D") = 0 And Cells(i, "E") = 0 Then 
        Rows(i).EntireRow.Hidden = True 
    End If 
Next 
End Sub
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

ravishankar

Well-known Member
Joined
Feb 23, 2006
Messages
3,566
HI
try this modification
Code:
Public Sub Hiderows() 
Dim i As Integer 
For i = 11 To 57
If Cells(i, "B") = "" And Cells(i, "C") = "" And Cells(i, "D") = "" Then 
Rows(i).EntireRow.Hidden = True 
End If 
Next i
End Sub
Ravi
 

Forum statistics

Threads
1,181,720
Messages
5,931,668
Members
436,797
Latest member
fullmetalpogi

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Top