View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
kc9r0n kc9r0n is offline
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