Lets say you have some code built to dynamically build an Excel report for your company. You've got a header record with tons of detail records and want the ability to hide the detail records. Add the following to select and group rows dynamically in ASP .NET (VB Code Shown):
This will select rows from 4-7 (in this case in the B column) and group them together. In this case, you would either have your details go from 4-6 and your Header at 7 or (since that seems backwards), a header at 3 and records from 4-6 (note: if 7 has data, that will be what is shown when the group is collapsed).