Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jun 10, 3:30*am, "percy/pista/johnny"
wrote: I am currently working on a project using Ms Excel. There are 50 Rows on my excel sheet and i would like to hide some rows depending on the inputs in other cells. For e.g: In cells B31, the user selects one product from a drop down list( A, B and C). Say the user selected products A, *i want excel to be able to unhidden everything that is related to *A. i need code for this..pls reply soon..its urgent Percy/Pista/Johnny, Your post is rather vague, so if you want a more concise answer, please provide a more descriptive explanation along with any code you have created; this will likely merit a better response from the group. You can embed your code within the SelectionChange event to test whether the drop down list has changed. (I'm assuming your drop down is created from the data validation option). You can then run ExecuteExcel4Macro to hide and unhide rows or columns (see sample code below). Best, Matthew Herbert Sub HideUnhide() Dim rngExpand As Range Dim strExecute As String 'create a range object to work with Set rngExpand = Range("A2") '-------------------------------------------------------------- 'General Comments for hiding and unhiding groupings ' 'Show.Detail ' Arg1 = 1 (Row) or 2 (Column) ' Arg2 = Row or Column inside of or including the +/- outline ' Arg3 = True (Unhide) or False (Hide) ' '-------------------------------------------------------------- 'unhide a grouping strExecute = "Show.Detail(1," & rngExpand.Row & ",True)" ExecuteExcel4Macro strExecute 'hide a grouping strExecute = "Show.Detail(1," & rngExpand.Row & ",False)" ExecuteExcel4Macro strExecute End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copying only unhidden rows | Excel Discussion (Misc queries) | |||
Print only unhidden rows | Excel Worksheet Functions | |||
How do I copy only the unhidden rows/colums? | Excel Discussion (Misc queries) | |||
hide/unhide rows depending on the top input value | Excel Programming | |||
sumif only for unhidden rows | Excel Worksheet Functions |