Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Is the active cell part of a named range

how do use VBA to determine whether or not the activecell is part of a range
named "Data"
i.e., range("Data") spans from A1:J50

how can i return true on
range("B5") is part os range("Data")
TIA.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Is the active cell part of a named range

use the Intersect method

Sub Test()
msgbox IsInRange(Range("B5"),range("Data"))
End Sub

Function IsInRange(test as range, target as range) as Boolean
dim found as range
set found = Intersect(Test,target)
IsInRange = (NOT Found Is Nothing)
End Function

"Virginia" wrote in message
...
how do use VBA to determine whether or not the activecell is part of a
range
named "Data"
i.e., range("Data") spans from A1:J50

how can i return true on
range("B5") is part os range("Data")
TIA.



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 based on active Named Range; IF Function to VBA Todd[_4_] Excel Worksheet Functions 1 December 1st 11 09:01 PM
Referencing a named range based upon Range name entry in cell Barb Reinhardt Excel Worksheet Functions 14 June 20th 07 07:19 PM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM
VLookup Error in Part of a Named Range Dallas64 Excel Worksheet Functions 6 April 18th 06 02:13 PM
Test if Active Cell is in a named range Simon Shaw[_5_] Excel Programming 1 September 28th 04 12:11 AM


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