Programming Outline Expand(+) / Collapse(-) Functionality

  • Thread starter Thread starter Stephen
  • Start date Start date
S

Stephen

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!
 
What do you mean by "collapsing" and "expanding". Hiding and unhiding?
Otto
 
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.
 
Use Application.Outline.ShowLevels RowLevels:=x, ColumnLevels:=y

HTH,
Matthew Pfluger
 
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);
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top