how to hide with conditional formatting

alan myers

Board Regular
Joined
Oct 31, 2017
Messages
119
Office Version
  1. 365
Platform
  1. Windows
how can i hide a row if say d5 = 0
then check d6 if 0 hide that row and so on
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Unfortunately, I cannot see your data sheet from my present location. My workplace security settings block those sites. So I won't be able to see it until later tonight when I am at my home computer.
 
Upvote 0
So, are you trying to hide/show the rows on Main sheet depending on what is in column E of the data sheet?
Is there a one-to-one correspondence in row between the two sheets (so column E on row 4 of the Data sheet effects row 4 on the Main sheet, etc)?
 
Upvote 0
if cell e on data sheet is greater then 0 it shows on main sheet and when it is 0 it hides
 
Upvote 0
OK, there is another important question I forgot to ask, if this is to be automated as data is entered.
Is column E on the Data sheet hard-coded, or is a formula (I am guessing a formula)?
If a formula, what is the exact formula?
If we want it to be automated, we want to key in on the data changes that people are making manually. So we need to know what column changes affect column E.
 
Upvote 0
on data sheet column e is typed in
then on main sheet column e get the data sheet values by =Data!E3
 
Upvote 0
Excellent!

Ok, go to the Data tab, right-click on the sheet tab name on the bottom of the screen, and select "View Code".
Now paste the following VBA code in the VB Editor window that pops up.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    Dim rng As Range
    Dim cell As Range
    
'   See if any cell just updated is in column E
    Set rng = Intersect(Target, Columns("E:E"))
    
'   Exit if no cells in range
    If rng Is Nothing Then Exit Sub
    
'   Loop through updated cells
    For Each cell In rng
'       Hide same row on Main sheet if 0
        If cell = 0 Then
            Sheets("Main").Rows(cell.Row).Hidden = True
'       Otherwise unhide it
        Else
            Sheets("Main").Rows(cell.Row).Hidden = False
        End If
    Next cell

End Sub
This should do what you want automatically.
 
Upvote 0
1591684670578.png
 
Upvote 0

Forum statistics

Threads
1,215,025
Messages
6,122,731
Members
449,093
Latest member
Mnur

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
Back
Top