Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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 possibl
from VBA

--
BlindGuardia
-----------------------------------------------------------------------
BlindGuardian's Profile: http://www.excelforum.com/member.php...fo&userid=2420
View this thread: http://www.excelforum.com/showthread.php?threadid=37813

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can VBA determine if a cell/range is in a 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.


--
BlindGuardian
------------------------------------------------------------------------
BlindGuardian's Profile: http://www.excelforum.com/member.php...o&userid=24202
View this thread: http://www.excelforum.com/showthread...hreadid=378137

  #3   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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,

Dim Rng As Range
Set Rng = Range("A1")
If Not Application.Intersect(Rng, Range("A1:A10")) Is Nothing
Then
' Rng is in A1:A10
Else
' Rng is not in A1:A10
End If


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




"BlindGuardian"

wrote in message
news:BlindGuardian.1qf9yd_1118426712.4717@excelfor um-nospam.com...

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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can VBA determine if a cell/range is in a group?


I think this may work for you: OutlineLevel

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


Sub Test()

Dim IsGrouped As Boolean

IsGrouped = (ActiveCell.Rows.OutlineLevel 1)

MsgBox "Grouped: " & IsGrouped

End Sub



Does that help?

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can VBA determine if a cell/range is in a group?


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.


--
BlindGuardian
------------------------------------------------------------------------
BlindGuardian's Profile: http://www.excelforum.com/member.php...o&userid=24202
View this thread: http://www.excelforum.com/showthread...hreadid=378137

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can VBA determine if a cell/range is in a group?


You're very welcome. I'm glad that worked for you. Thanks for updating
me

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can VBA determine if a cell/range is in a group?


Ron has pointed me in the right direction

--
BlindGuardia
-----------------------------------------------------------------------
BlindGuardian's Profile: http://www.excelforum.com/member.php...fo&userid=2420
View this thread: http://www.excelforum.com/showthread.php?threadid=37813

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
use active cell to determine range Gizmo Excel Discussion (Misc queries) 2 March 31st 08 04:55 AM
Value of cell to determine range in MAX Function [email protected] Excel Worksheet Functions 8 February 18th 06 06:34 PM
Determine if Cell Address is within a Range John Michl Excel Worksheet Functions 4 December 22nd 05 07:59 PM
Can VBA determine if a cell/range is in a group? Ron Coderre[_11_] Excel Programming 0 June 10th 05 06:49 PM
I need to determine a cell range based on a blank cell Katrina Excel Programming 1 July 3rd 03 09:11 PM


All times are GMT +1. The time now is 01:12 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"