Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default How to verify if a range (or a cell) is contained in another range

Hi all.
As above written, how can i get this? The issue is the follow: with VBA I
extended conditional formatting with a lot of features, exceeding the normal
3 condition. Now I need this "personal conditional formatting" works only for
the changed cell in a specific range and not in alla worksheet.

Thank you in advance for tips, advice and suggestions.
Nicola
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 468
Default How to verify if a range (or a cell) is contained in another range

From Immediate Window

? Not Application.Intersect(Range("Range1"),Range("Range 2")) is Nothing
True << produced answer..

"Nicola M" wrote:

Hi all.
As above written, how can i get this? The issue is the follow: with VBA I
extended conditional formatting with a lot of features, exceeding the normal
3 condition. Now I need this "personal conditional formatting" works only for
the changed cell in a specific range and not in alla worksheet.

Thank you in advance for tips, advice and suggestions.
Nicola

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default How to verify if a range (or a cell) is contained in another range

Nicola,

One way is with worksheet change where you can capture the address of the
cell that has changed and act accordingly. The code below only executes if
the changed cell is in the range A1 - A100.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
'If Not Intersect(Target, Range("A1:A100")) Is Nothing Then

Application.EnableEvents = False

'do things
Application.EnableEvents = True
End If
End Sub


Mike


"Nicola M" wrote:

Hi all.
As above written, how can i get this? The issue is the follow: with VBA I
extended conditional formatting with a lot of features, exceeding the normal
3 condition. Now I need this "personal conditional formatting" works only for
the changed cell in a specific range and not in alla worksheet.

Thank you in advance for tips, advice and suggestions.
Nicola

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How to verify if a range (or a cell) is contained in another range

Sub ProperSubSet()
Dim littleRange As Range
Dim bigRange As Range
Dim r As Range
Set littleRange = Range("A2:D9")
Set bigRange = Range("A1:Z100")
For Each r In littleRange
If Intersect(r, bigRange) Is Nothing Then
MsgBox ("Little not contained with Big")
Exit Sub
End If
Next
MsgBox ("Little contained with Big")
End Sub

--
Gary''s Student - gsnu200817
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default How to verify if a range (or a cell) is contained in another r

Thank you so much, guys. It's just that I was looking for
[CUT]
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
Conditional formatting when text is contained in a named range Hugh Excel Discussion (Misc queries) 2 July 31st 09 02:35 PM
Verify Active Cell is within a Range that changes as cell is delet Shannon Excel Programming 2 February 11th 06 12:01 AM
Function to determine if any cell in a range is contained in a given cell [email protected] Excel Worksheet Functions 3 February 7th 05 04:19 PM
How to verify a cell is in a named range Terry Lowe[_2_] Excel Programming 1 July 14th 04 01:06 AM
Range.Find returns cell outside of range when range set to single cell Frank Jones Excel Programming 12 June 10th 04 04:22 AM


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