Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Worksheet_SelectionChange


I have something like this on a larger scale:

5 cells: A1, B1 and B2, C1 and C2.

If I enter value in B1, B2 becomes 0. And vice-versa.
If I enter 0 in A1, then B1 and B2 becomes 0.
If C1 is 0 I cannot enter values in B1, and if C2 is 0 I cannot ente
value in B2.


The problem is, if I use Worksheet_Change event, then the event i
fired twice when I try to enter a value in B1 (whe C1 is 0), because
undo the action in this case, which fires the event on resetting B2.

If I use Worksheet_SelectionChange, then it works well as long as
press the ENTER button after entering a value, but if I use the arro
keys, then the whole logic goes for a toss.

Any better alternatives.....?

- Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=27203

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Worksheet_SelectionChange

Hi
use the worksheet_change event but before changing data in the sheet use the
statement
application.enableevents=false

And don't forget to enable them again at the end of your event procedure with
application.enableevents=true


"mangesh_yadav" wrote:


I have something like this on a larger scale:

5 cells: A1, B1 and B2, C1 and C2.

If I enter value in B1, B2 becomes 0. And vice-versa.
If I enter 0 in A1, then B1 and B2 becomes 0.
If C1 is 0 I cannot enter values in B1, and if C2 is 0 I cannot enter
value in B2.


The problem is, if I use Worksheet_Change event, then the event is
fired twice when I try to enter a value in B1 (whe C1 is 0), because I
undo the action in this case, which fires the event on resetting B2.

If I use Worksheet_SelectionChange, then it works well as long as I
press the ENTER button after entering a value, but if I use the arrow
keys, then the whole logic goes for a toss.

Any better alternatives.....?

- Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=272030


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
Worksheet_SelectionChange not working Bo Rasmussen New Users to Excel 1 December 13th 04 02:34 PM
Worksheet_SelectionChange Rasmus[_2_] Excel Programming 2 June 27th 04 07:19 PM
Worksheet_SelectionChange Bill Oertell[_2_] Excel Programming 8 April 23rd 04 05:18 AM
worksheet_SelectionChange Event ibeetb Excel Programming 1 January 16th 04 04:05 AM
Worksheet_SelectionChange Event G R E G Excel Programming 5 August 27th 03 07:59 PM


All times are GMT +1. The time now is 01:29 AM.

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"