Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Stop code if cell C8 is selected.

I want to add some code to the top of my module that will stop the code if
Cell C8 on the active worksheet is selected.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stop code if cell C8 is selected.


If Not Application.Intersect(ActiveCell, _
ActiveSheet.Range("C8")) Is Nothing Then

Stop
End If


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=151276

Microsoft Office Help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Stop code if cell C8 is selected.

Specifically what do you mean by "stop the code"? If you mean to quit
the currently executing procedure and return to the caller (or to
Excel if there is no caller), use something like


If Not Application.Intersect(Selection, _
Range("C8")) Is Nothing Then
Exit Sub
End If


If you really mean Stop, as in enter debug mode, use an Assert.

Debug.Assert Application.Intersect(Selection, _
Range("C8")) Is Nothing

An Assert enters debug mode if the expression in the Assert is False.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Thu, 5 Nov 2009 01:11:06 -0800, "ordnance1"
wrote:

I want to add some code to the top of my module that will stop the code if
Cell C8 on the active worksheet is selected.

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
VBA Code when a cell is selected [email protected] Excel Discussion (Misc queries) 3 June 13th 07 08:50 PM
Stop next cell being selected on Enter Ken G. Excel Discussion (Misc queries) 2 December 6th 05 07:21 AM
Stop next cell being selected on Enter Jeff Stevens Excel Discussion (Misc queries) 0 December 6th 05 06:55 AM
VB code to find the selected cell Andrew[_22_] Excel Programming 2 September 9th 03 06:29 AM


All times are GMT +1. The time now is 07:03 PM.

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"