I have a range on a worksheet (A1:F15) . In code, this is referred to as MyMaze. How can I flag if a cell outside this range is selected?
TIA
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Not In Range (xp)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Not In Range (xp)
- This topic has 6 replies, 4 voices, and was last updated 19 years, 7 months ago.
AuthorTopicViewing 1 reply threadAuthorReplies-
WSHansV
AskWoody Lounger -
WSbandido
AskWoody Lounger -
H. Legare Coleman
AskWoody Plus -
WSHansV
AskWoody Lounger -
H. Legare Coleman
AskWoody Plus
-
-
-
-
WSdcardno
AskWoody LoungerOctober 7, 2005 at 5:52 pm #977677In the SelectionChange event, test for whether the desired range includes the selection; something like (warning, air code)
private sub Worksheet_SelectionChange(byval Target as range) if intersect([mymaze],target) is nothing then ' code to perform if selection is outside "MyMaze" else 'code if selection is inside "MyMaze" end if end sub
Note:
- the method to refer to the area where you want to confine the selection will depend on how it is used or already defined – this example assumes that it is a named range within excel, but if it already a range object you can just use the name.
- there is a flaw in this test if you are going to allow multi-cell selections – in this case, part of the selection could be within MyMaze, and part could be outside – you have to decide what to do with such a selection, and then test for it – possibly by testing for “if union([mymaze],target) = mymaze” – this will be true only if target is entirely contained within mymaze
[/list]
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
No more rounded corners??
by
CWBillow
1 hour, 51 minutes ago -
Android 15 and IPV6
by
Win7and10
32 minutes ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
11 hours, 47 minutes ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
14 hours, 29 minutes ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
9 hours, 4 minutes ago -
Windows Update orchestration platform to update all software
by
Alex5723
21 hours, 48 minutes ago -
May preview updates
by
Susan Bradley
9 hours, 11 minutes ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
46 minutes ago -
Just got this pop-up page while browsing
by
Alex5723
14 hours ago -
KB5058379 / KB 5061768 Failures
by
crown
11 hours, 4 minutes ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
24 minutes ago -
At last – installation of 24H2
by
Botswana12
1 day, 13 hours ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
22 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
2 days, 1 hour ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
1 day, 18 hours ago -
Limited account permission error related to Windows Update
by
gtd12345
2 days, 14 hours ago -
Another test post
by
gtd12345
2 days, 15 hours ago -
Connect to someone else computer
by
wadeer
2 days, 9 hours ago -
Limit on User names?
by
CWBillow
2 days, 12 hours ago -
Choose the right apps for traveling
by
Peter Deegan
2 days, 2 hours ago -
BitLocker rears its head
by
Susan Bradley
1 day, 10 hours ago -
Who are you? (2025 edition)
by
Will Fastie
1 day, 9 hours ago -
AskWoody at the computer museum, round two
by
Will Fastie
2 days, 4 hours ago -
A smarter, simpler Firefox address bar
by
Alex5723
3 days, 1 hour ago -
Woody
by
Scott
3 days, 10 hours ago -
24H2 has suppressed my favoured spider
by
Davidhs
1 day, 10 hours ago -
GeForce RTX 5060 in certain motherboards could experience blank screens
by
Alex5723
4 days, 1 hour ago -
MS Office 365 Home on MAC
by
MickIver
3 days, 18 hours ago -
Google’s Veo3 video generator. Before you ask: yes, everything is AI here
by
Alex5723
4 days, 15 hours ago -
Flash Drive Eject Error for Still In Use
by
J9438
1 day, 9 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.