Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default worksheet_change becoming active just by entering the cell

I have the following code in my worksheet:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' Watching for changes in cells {H,L,O,T}{2,5,8,...}
If (Target.Cells.Count = 1 And _
Target.Row Mod 3 = 2 And _
Target.Column Mod 4 = 0 And _
Target.Column = 8 And _
Target.Column <= 20) Then
If (Target.Value 0) Then
On Error GoTo ErrHandler
Application.EnableEvents = False
Call CheckDosage(Target)

ErrHandler:
Application.EnableEvents = True
On Error GoTo 0
End If
End If
End Sub

I have the following problems and wondering is behavior is expected:
1) If I click on or enter one of these cells(arrow keys), my sub routine is
called. (Cell not changed, just visited)
2) if I enter data into one of these cells and if I use an arrow key, tab
key, or enter (and have "Move selection after Enter"), the sub routine is
not called.

Do I need to somehow use Application.OnKey to "see" the changed cell b4 we
physically move from it?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default worksheet_change becoming active just by entering the cell



"kc9r0n" wrote:

I have the following code in my worksheet:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' Watching for changes in cells {H,L,O,T}{2,5,8,...}
If (Target.Cells.Count = 1 And _
Target.Row Mod 3 = 2 And _
Target.Column Mod 4 = 0 And _
Target.Column = 8 And _
Target.Column <= 20) Then
If (Target.Value 0) Then
On Error GoTo ErrHandler
Application.EnableEvents = False
Call CheckDosage(Target)

ErrHandler:
Application.EnableEvents = True
On Error GoTo 0
End If
End If
End Sub

I have the following problems and wondering is behavior is expected:
1) If I click on or enter one of these cells(arrow keys), my sub routine is
called. (Cell not changed, just visited)
2) if I enter data into one of these cells and if I use an arrow key, tab
key, or enter (and have "Move selection after Enter"), the sub routine is
not called.

Do I need to somehow use Application.OnKey to "see" the changed cell b4 we
physically move from it?


nevermind I am using selectionchange not chang! duh

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
Row select mode to highlight active row of active cell Bart Fay[_2_] Excel Discussion (Misc queries) 0 May 11th 10 09:34 PM
getting the selected range and active cell of a non active worksheetsheet GerryGerry Excel Programming 7 September 23rd 09 05:22 PM
How to get the correct active Cell position in Worksheet_Change Johan2000 Excel Programming 2 March 6th 08 01:58 AM
run macro although blinking cursor is active in an active cell bartman1980 Excel Programming 1 December 20th 07 11:29 AM
I need to sort an active sheet using the col of the active cell HamFlyer Excel Programming 3 June 6th 06 07:25 PM


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