VBA code to ungroup multiple groupings

C

CM4@FL

For example: Say I have a spreadsheet with 3 layers of row grouping.

Currently I'm using the following code to ungroup all 3 layers, which works
for the this particular example.
Selection.Rows.Ungroup
Selection.Rows.Ungroup
Selection.Rows.Ungroup

Unfortunately the spreadsheet in question does not always have 3 layers of
grouping, it may have more it may have less. Which either cause the VBA to
error or not remove all the groupings. Is there any coding that will remove
all groupings within a worksheet without reference to the # of layers?

Thanks in advance!
 
B

Bob Umlas

Sub BruteForce()
On Error Resume Next
For I=1 to 8
Selection.Rows.Ungroup
Next
End Sub
 
R

Rick Rothstein

How many groupings do you have? Are you trying to get rid of them all? Does
this, perhaps, do what you want?

Selection.Rows.ClearOutline
 
C

Charlie

Hey Rick,

I didn't understand your post under "VBA mid() function" on 11/2/09. Did I
miss something?
 
R

Rick Rothstein

I responded to your message back in the original thread... are you saying
you can't see it? Here it is again...

"No, you didn't miss anything... I did. Sorry for the confusion,
but apparently I misread the original post and then made
my comment based on my misreading."
 
C

Charlie

Thanks. No, it never posted. Or at least I can't find it. I thought I was
losing my mind. (Again.) :)
 

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

Top