Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Testing if a cell is within a range

Hello all,

Is it possible to test if the active cell is within a certain range?

I have a short list of categories, A36:A47, that I have given the range the name "CategoriesList". In the
"Worksheet_SelectionChange" event, I want to test to see if the new active cell is within the CategoriesList range and if it is, set
another cell on the worksheet to the same value as the active cell.

If it is possible, please provide sample code.

--
Thanks for any help anyone can provide,

Conan Kelly


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Testing if a cell is within a range

Try this...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("A36:A47")) Is Nothing Then
MsgBox Target.Address
End If
End Sub

--
HTH...

Jim Thomlinson


"Conan Kelly" wrote:

Hello all,

Is it possible to test if the active cell is within a certain range?

I have a short list of categories, A36:A47, that I have given the range the name "CategoriesList". In the
"Worksheet_SelectionChange" event, I want to test to see if the new active cell is within the CategoriesList range and if it is, set
another cell on the worksheet to the same value as the active cell.

If it is possible, please provide sample code.

--
Thanks for any help anyone can provide,

Conan Kelly



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Testing if a cell is within a range


If Not Intersect(Target,Range("CategoriesList")) Is Nothing Then
'do your thing

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Conan Kelly" <CTBarbarin at msn dot com wrote in message
...
Hello all,

Is it possible to test if the active cell is within a certain range?

I have a short list of categories, A36:A47, that I have given the range

the name "CategoriesList". In the
"Worksheet_SelectionChange" event, I want to test to see if the new active

cell is within the CategoriesList range and if it is, set
another cell on the worksheet to the same value as the active cell.

If it is possible, please provide sample code.

--
Thanks for any help anyone can provide,

Conan Kelly




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Testing if a cell is within a range

Jim,

Thank you for your feedback. You and Bob Phillips had the same response. It worked beautifully.

Thanks again for all of your help,

Conan



"Jim Thomlinson" wrote in message
...
Try this...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("A36:A47")) Is Nothing Then
MsgBox Target.Address
End If
End Sub

--
HTH...

Jim Thomlinson


"Conan Kelly" wrote:

Hello all,

Is it possible to test if the active cell is within a certain range?

I have a short list of categories, A36:A47, that I have given the range the name "CategoriesList". In the
"Worksheet_SelectionChange" event, I want to test to see if the new active cell is within the CategoriesList range and if it is,
set
another cell on the worksheet to the same value as the active cell.

If it is possible, please provide sample code.

--
Thanks for any help anyone can provide,

Conan Kelly





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Testing if a cell is within a range

Bob,

Thank you for your feedback. You and Jim Thomlinson had the same response. It worked beautifully.

Thanks again for all of your help,

Conan


"Bob Phillips" wrote in message ...

If Not Intersect(Target,Range("CategoriesList")) Is Nothing Then
'do your thing

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Conan Kelly" <CTBarbarin at msn dot com wrote in message
...
Hello all,

Is it possible to test if the active cell is within a certain range?

I have a short list of categories, A36:A47, that I have given the range

the name "CategoriesList". In the
"Worksheet_SelectionChange" event, I want to test to see if the new active

cell is within the CategoriesList range and if it is, set
another cell on the worksheet to the same value as the active cell.

If it is possible, please provide sample code.

--
Thanks for any help anyone can provide,

Conan Kelly






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
testing range of cells for part of cell content Daniel Excel Worksheet Functions 5 March 25th 10 08:14 PM
Testing a range for blanks Guy Normandeau Excel Programming 1 July 5th 06 02:37 PM
testing whether the ActiveCell is in a given range Paul Ponzelli Excel Programming 2 August 10th 05 05:20 PM
Testing for content in Range Jim McLeod[_3_] Excel Programming 1 July 13th 04 05:58 PM
Cell in Range Testing Function Jim C.[_2_] Excel Programming 2 July 23rd 03 06:59 PM


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