LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default How to test if a range is with in another range?

Specifically, I'm using a select...case statement in a Worksheet_change()
procedure to test which cell is being changed by the user. In this example
you can see why my approach isn't suitable:

Select Target.Address(false,false)
Case "D9" to "D30"
DoSomeStuff
End Select

Alphabetically "D30" occurs before "D9" so this test fails.

I could test for each range individually like "D9","D10","D11",etc... but
that's long and sloppy. There must be an easier way to test if a range is
within or between another range? (BTW, I realize this won't work on a
selection across multiple rows and columns. I have accounted for that.)

TIA
-Mike


 
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
Test within a range? JC Excel Worksheet Functions 3 May 25th 07 03:41 AM
How I set up as logical test if my range has to be >=2 but <5 nsnjlacm Excel Discussion (Misc queries) 2 May 7th 05 08:04 PM
Worksheet_Change and range test Willow[_5_] Excel Programming 1 April 1st 05 12:21 PM
== How to test if a range var contains nothing hcova[_2_] Excel Programming 3 October 25th 04 10:08 PM
how do i test for the existence of a range name Jake Marx[_3_] Excel Programming 2 March 3rd 04 09:57 PM


All times are GMT +1. The time now is 11:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"