Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default VBA code to ungroup multiple groupings

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!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 320
Default VBA code to ungroup multiple groupings

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

"CM4@FL" wrote in message
...
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!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default VBA code to ungroup multiple groupings

On Error GoTo done
Do While Rows.Ungroup
Loop
done:


"CM4@FL" wrote:

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!


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default VBA code to ungroup multiple groupings

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

--
Rick (MVP - Excel)


"CM4@FL" wrote in message
...
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!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default VBA code to ungroup multiple groupings

Hey Rick,

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

"Rick Rothstein" wrote:

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

--
Rick (MVP - Excel)


"CM4@FL" wrote in message
...
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!



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default VBA code to ungroup multiple groupings

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."

--
Rick (MVP - Excel)


"Charlie" wrote in message
...
Hey Rick,

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

"Rick Rothstein" wrote:

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

--
Rick (MVP - Excel)


"CM4@FL" wrote in message
...
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!



.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default VBA code to ungroup multiple groupings

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

"Rick Rothstein" wrote:

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."

--
Rick (MVP - Excel)


"Charlie" wrote in message
...
Hey Rick,

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

"Rick Rothstein" wrote:

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

--
Rick (MVP - Excel)


"CM4@FL" wrote in message
...
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!



.


.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ungroup workbooks into multiple instances of excel Confused Excel Discussion (Misc queries) 2 February 28th 09 07:51 PM
Cell Groupings J. Glynn Excel Worksheet Functions 2 January 27th 09 06:13 PM
Excel should allow tab groupings. Bassam Abdul-Baki Excel Discussion (Misc queries) 11 June 3rd 06 07:04 AM
Subtotals/Groupings Gary Excel Worksheet Functions 0 May 9th 06 12:52 PM
Groupings Jason[_28_] Excel Programming 4 January 30th 04 08:08 PM


All times are GMT +1. The time now is 08:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"