What is the vba code for expanding and collapsing a range of columns or rows?
I want my program to expand a group of columns, print a named range, and
then collapse it once again.
Any suggetions would be greatly appreciated.
Thanks!

Signature
Stephen
Otto Moehrbach - 23 Jan 2008 02:42 GMT
What do you mean by "collapsing" and "expanding". Hiding and unhiding?
Otto
> What is the vba code for expanding and collapsing a range of columns or
> rows?
[quoted text clipped - 4 lines]
>
> Thanks!
Stephen - 23 Jan 2008 04:37 GMT
Otto,
My spreadsheet contains outlined data. I use the "1" and "2" boxes in the
upper left hand corner to hide / display the columns I have grouped.
Alternately, I could click the "+" /"-" above the outlined columns to
unhide/hide these columns.
I grouped these columns with the Data...Group and Outline menu command
Thanks for taking the time to respond.

Signature
Stephen
> What do you mean by "collapsing" and "expanding". Hiding and unhiding?
> Otto
[quoted text clipped - 6 lines]
> >
> > Thanks!
Matthew Pfluger - 14 Feb 2008 21:38 GMT
Use Application.Outline.ShowLevels RowLevels:=x, ColumnLevels:=y
HTH,
Matthew Pfluger
> Otto,
>
[quoted text clipped - 17 lines]
> > >
> > > Thanks!
serhio - 22 Apr 2008 12:13 GMT
Use the "Group" method, row by row, or a entire range
for (int i = upperRowNumber; i <= lowerRowNumber; i++)
{
cellA = savedWorksheet.get_Range(string.Format("{0}{1}",
ACellName, i), Missing.Value);
cellB = savedWorksheet.get_Range(string.Format("{0}{1}",
BCellName, i), Missing.Value);
if (cellA.Value2 == null)
{
if (cellB.Value2 != null)
(savedWorksheet.Rows[i, Missing.Value] as Range).
Group(Missing.Value, Missing.Value,
Missing.Value, Missing.Value);
}
}