Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Choo, Sally,
First of all, you need VBA to select what you want to get grouped. Let's assume, that you are in the leftmost top cell of the range you are interested in (in your example it would be A1). Then you run the following code: Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlToRight)).Select After that you can do the grouping. This code does it for you: Selection.Subtotal GroupBy:=2, Function:=xlCount, TotalList:=Array(3), _ Replace:=True, PageBreaks:=False, SummaryBelowData:=True ActiveSheet.Outline.ShowLevels RowLevels:=2 The 2 means column 2 in your range contains which element should be counted, the Array(3) says that the result of each counting should be displayed in column 3 of your range. The last row says that it should do the grouping and only display the results and hide the elements. Hope this is what you have expected. Have a nice weekend Udo |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
auto grouping. | Excel Discussion (Misc queries) | |||
Using Grouping and Sorting and Auto Filter | Excel Discussion (Misc queries) | |||
Auto-populate, Auto-copy or Auto-fill? | Excel Worksheet Functions | |||
Auto Excel workbook close: save= false during an auto subroutine | Excel Programming | |||
Auto Filter and Grouping | Excel Discussion (Misc queries) |