Closed Thread
Results 1 to 9 of 9

Can VBA determine if a cell/range is in a group?

  1. #1
    Registered User
    Join Date
    06-10-2005
    Posts
    4

    Can VBA determine if a cell/range is in a group?

    I'd like to find if a selected cell is within a group. Is this possible from VBA?

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996
    A Group?
    Do you mean is the active cell part of a selection of several cells?

    Regards,
    Ron

  3. #3
    Registered User
    Join Date
    06-10-2005
    Posts
    4

    Outline/Group

    Hi Ron,

    In my case, I have several rows that have been grouped in an outline i.e. a grey bar appears on the left with "+" and "-" characters that allow me to expand and collapse the rows which belong to the group. The visibility of these can change by setting the Tools --> Options... --> View (tab) --> Outline symbols (checkbox).

    What I want to know is if my selection is currently within one of those rows which is in a group. I have not been able to find anything using Excel/VBA help to discover a property that seems to indicate whether a cell is part of a group or not. The nearest I've seen is IndentLevel but that always returns 0.

    Thanks for taking the time to respond.

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996
    I think this may work for you: OutlineLevel

    It will return 2, or more, if grouped in an outline. 1 if not outlined.


    Please Login or Register  to view this content.

    Does that help?

    Ron
    Last edited by VBA Noob; 08-26-2008 at 02:35 PM.

  5. #5
    Registered User
    Join Date
    06-10-2005
    Posts
    4

    Ahh - that was the trick (i.e. Rows property)

    Previously when I tried

    ActiveCell.OutlineLevel

    I kept getting an error that it could not retrieve the property from the object. Now I see that OutlineLevel is a property that must be applied for a Rows object.

    Thanks very much for your help, Ron.

  6. #6
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996
    You're very welcome. I'm glad that worked for you. Thanks for updating me

    Regards,
    Ron

  7. #7
    ben
    Guest

    Re: Can VBA determine if a cell/range is in a group?

    IF you mean is the active cell selected part of a NAMED RANGE or another
    group of somehow defined cells, then yes Look up vba help for the
    INTERSECT property
    --
    When you lose your mind, you free your life.


    "Ron Coderre" wrote:

    >
    > A Group?
    > Do you mean is the active cell part of a selection of several cells?
    >
    > Regards,
    > Ron
    >
    >
    > --
    > Ron Coderre
    > ------------------------------------------------------------------------
    > Ron Coderre's Profile: http://www.excelforum.com/member.php...o&userid=21419
    > View this thread: http://www.excelforum.com/showthread...hreadid=378137
    >
    >


  8. #8
    Chip Pearson
    Guest

    Re: Can VBA determine if a cell/range is in a group?

    You can use the Intersect method to determine whether a cell is
    in another range of cells. For example,

    Please Login or Register  to view this content.

    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com




    "BlindGuardian"
    <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > I'd like to find if a selected cell is within a group. Is this
    > possible
    > from VBA?
    >
    >
    > --
    > BlindGuardian
    > ------------------------------------------------------------------------
    > BlindGuardian's Profile:
    > http://www.excelforum.com/member.php...o&userid=24202
    > View this thread:
    > http://www.excelforum.com/showthread...hreadid=378137
    >
    Last edited by VBA Noob; 08-26-2008 at 02:36 PM.

  9. #9
    Registered User
    Join Date
    06-10-2005
    Posts
    4

    Thanks, ben and Chip - problem has been solved.

    Ron has pointed me in the right direction.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1