danomaniac
Programmer
Is there any way to expand or collapse a data group in Excel using VBA?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
'First set outline settings for Group method
With l_wksReport.Outline
.SummaryRow = xlSummaryAbove
.AutomaticStyles = True
End With
'Now switch the group on: l_sRefersTo = the rows to group, e.g. [b]"8:20"[/b]
l_wksReport.Rows(l_sRefersTo).Group
'Hide the details under the rows you've grouped;
'l_iGroupStart = the first row of the group - in the example row [b]8[/b]
l_wksReport.Rows(l_iGroupStart).ShowDetail = False