Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CW CW is offline
external usenet poster
 
Posts: 54
Default Detect if a cell is within a group

Its possible to build a group of cells using Rangte.Group, but how is it
possible to detect if a cell is within a group or iterate through all members
of a group?
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Detect if a cell is within a group

It sounds like you don't want to use .group. I'm betting that you want to use
Union()

Like:

Dim myRng as range
with activesheet
set myrng = union(.range("a1:b9"),.range("c7:D99"),.range("x1: z3"))
end with

Then you can use Intersect to see if a cell is in a range:

dim myCell as range
set mycell = activesheet.range("b33")
if intersect(mycell, myrng) is nothing then
'not in that range
else
'yep, it is
end if



cw wrote:

Its possible to build a group of cells using Rangte.Group, but how is it
possible to detect if a cell is within a group or iterate through all members
of a group?
Thanks


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
CW CW is offline
external usenet poster
 
Posts: 54
Default Detect if a cell is within a group

Sorry, its another problem:
How ist it possible to detect that a user has build a group within excel
using the appropriate menu entry?
I want to check for a specific range using VBA if the cells has been
inserted into a group, i dont want to build a group using VBA, just check if
a call is within a group.


"Dave Peterson" wrote:

It sounds like you don't want to use .group. I'm betting that you want to use
Union()

Like:

Dim myRng as range
with activesheet
set myrng = union(.range("a1:b9"),.range("c7:D99"),.range("x1: z3"))
end with

Then you can use Intersect to see if a cell is in a range:

dim myCell as range
set mycell = activesheet.range("b33")
if intersect(mycell, myrng) is nothing then
'not in that range
else
'yep, it is
end if



cw wrote:

Its possible to build a group of cells using Rangte.Group, but how is it
possible to detect if a cell is within a group or iterate through all members
of a group?
Thanks


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Detect if a cell is within a group

You mean Data|Group and Outline?

You can use VBA to look at the .outlinelevel

Option Explicit
Sub testme01()

Dim myRow As Range
Dim IsOutLineUsed As Boolean

IsOutLineUsed = False
For Each myRow In ActiveSheet.Range("A12:A25").entirerow.Rows
If myRow.OutlineLevel 1 Then
IsOutLineUsed = True
Exit For
End If
Next myRow

MsgBox IsOutLineUsed

End Sub

This example looks at all the rows between 12:25 to see if data|group and
outline has been applied to it.



cw wrote:

Sorry, its another problem:
How ist it possible to detect that a user has build a group within excel
using the appropriate menu entry?
I want to check for a specific range using VBA if the cells has been
inserted into a group, i dont want to build a group using VBA, just check if
a call is within a group.

"Dave Peterson" wrote:

It sounds like you don't want to use .group. I'm betting that you want to use
Union()

Like:

Dim myRng as range
with activesheet
set myrng = union(.range("a1:b9"),.range("c7:D99"),.range("x1: z3"))
end with

Then you can use Intersect to see if a cell is in a range:

dim myCell as range
set mycell = activesheet.range("b33")
if intersect(mycell, myrng) is nothing then
'not in that range
else
'yep, it is
end if



cw wrote:

Its possible to build a group of cells using Rangte.Group, but how is it
possible to detect if a cell is within a group or iterate through all members
of a group?
Thanks


--

Dave Peterson


--

Dave Peterson
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
How do I detect cell mode? [email protected] Excel Programming 5 September 19th 06 07:32 AM
Detect Cell Changes aga2957[_5_] Excel Programming 4 August 21st 06 06:03 AM
Detect if a cell value is a formula Jens Lenge Excel Programming 2 September 22nd 05 05:31 PM
How can I detect if user is in Group Mode when a macro starts? R-N Excel Programming 5 June 15th 04 01:16 PM
Detect Group mode Tim Aurthur Excel Programming 3 October 22nd 03 06:17 PM


All times are GMT +1. The time now is 09:13 AM.

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"