View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default Collapsing groups in Macro

Of course you can program this, or create a script for it. What is the logic?

Selection.Columns.Group expand = false
This doesn't really me anything to me. What do you have now and what do you
expect to see when the macro fires?

Thanks,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Cunning_Plan" wrote:

Whilst that is a useful work around for most of the time it wont work for me
currently. The data set im preparing needs to be formatted very specificly as
its being passed on to a number of people and feeds into a number of
mastersheets.

if there isn't a way to do this I'll have to design around it but you'd
think it would just be a simple function.... or perhaps a default setting in
the master options?



"ryguy7272" wrote:

Just turn on the macro recorder, select the groupings, hide, link the code to
a Button. Here is a method of hiding colored rows (you may or may not find
it useful):

Sub color_shower()
Dim b As Boolean

Set r = ActiveSheet.UsedRange
nLastRow = r.Rows.count + r.Row - 1

For rr = 1 To nLastRow
b = True
For cl = 1 To Columns.count
If Cells(rr, cl).Interior.ColorIndex < xlNone Then
b = False
End If
Next
If b Then
Cells(rr, 1).EntireRow.Hidden = True
End If
Next
End Sub

HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Cunning_Plan" wrote:

Hi all,

I've been writing a macro at work to re-format a large data set. In order to
make this more readable and to allow for better summaries both the columns
and rows are grouped (allowing them to be expanded or collapsed).

I was wondering if there is away to collapse the groups from within the
macro. I would like the default positions of the groups to be collapsed so
that when the macro finishes all groups are collapsed. something like:

Selection.Columns.Group expand = false

or some such....

The macro recorder produced no results and using a search term like groups
in a google search produces few useful results!

I would imagine from this i would also then be able to make a custom button
to collapse or expand all groups (unless this is already possible)

I'm using office 97.

Many thanks for any and all comments,

Cunning