Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Row select mode to highlight active row of active cell | Excel Discussion (Misc queries) | |||
getting the selected range and active cell of a non active worksheetsheet | Excel Programming | |||
How to get the correct active Cell position in Worksheet_Change | Excel Programming | |||
run macro although blinking cursor is active in an active cell | Excel Programming | |||
I need to sort an active sheet using the col of the active cell | Excel Programming |