Determining if sheet has grouped rows

jcg31

Board Regular
Joined
Aug 20, 2006
Messages
176
Is there a way of determining if any rows in a sheet are grouped using vba?

I need to write a script that groups rows accoding to new input from a user. I am starting by eliminating all groups.

Cells.Select
Selection.Rows.Ungroup

But it is throwing an error on sheets that don't have any rows grouped. I need to test for a group before running the above code. But don't know how to check.

Any help would be appreciated.
Jim
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
you need to use this, adapted to your own worksheet code name:

Code:
Sheet1.Rows.ClearOutline

Try not to use Select and Selection, it slows things down...
 
Upvote 0
you need to use this, adapted to your own worksheet code name:

Code:
Sheet1.Rows.ClearOutline

Perfect, I had written 12 lines of code to try and accomodate my first approach (looping through each row to determine outline levels). Now I can yank that out.

Many thanks!
Jim
 
Upvote 0

Forum statistics

Threads
1,224,568
Messages
6,179,595
Members
452,927
Latest member
whitfieldcraig

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top