PDA

View Full Version : Drop Down list Show/hide rows



brian003
07-01-2015, 10:36 AM
Hi everyone,

I have a workbook with two sheets. Sheet one is Information from customer with drop down list, sheet two has a summary what is from information sheet. I would like the summary sheet to show only what has been selected from drop down list from information sheet, if blank then hide rows in sheet two.

Attached is the file to understand better.

brian003
07-01-2015, 02:08 PM
This is the code I have so far. I want a statement to say if >0 show rows. If blank or 0 hide rows.

Thanks.



Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count > 1 Then Exit Sub

If Not Intersect(Target, Range("$I$10")) Is Nothing Then
With Sheet2
.Rows("14").EntireRow.Hidden = Target.Value = "0"

End With


End If

End Sub

p45cal
07-02-2015, 02:53 AM
Right-click the Estimate sheet's tab and choose View code , then paste the following bunch of code in the code-module that appears. Don't forget to save as xlsm file if it works.
Private Sub Worksheet_Activate()
hideUnhide
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
hideUnhide
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
hideUnhide
End Sub

Sub hideUnhide()
Application.ScreenUpdating = False
For Each cll In Range("$B$14:$B$28").Cells
cll.EntireRow.Hidden = (cll.Value = 0)
Next cll
Application.ScreenUpdating = True
End Sub

brian003
07-02-2015, 05:40 AM
Hi P45Cal,

Thank you for your help, exactly what I was looking for, really simple when you understand the code.

Take care.