Capture event when exit Column G

Z

zSplash

I want to code something whenever there's a change in Column G/8. Some
users use the Mouse, others use the Tab, others use the Enter key, so it
isn't just a Target.Column=9 deal.

Would someone please start me in the right direction for coding on exit of a
cell in Column G/8?

TIA
 
F

Frank Kabel

Hi
I'd use the slection_change event. Put the following code in your worksheet
module:
(Note: column G ist the 7th column)
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static old_column As Integer
If Target.Column <> 7 Then
If old_column = 7 Then
MsgBox "you just exited column G"
End If
End If
old_column = Target.Column
End Sub
 
Z

zSplash

Thanks, Frank.

st.
Frank Kabel said:
Hi
I'd use the slection_change event. Put the following code in your worksheet
module:
(Note: column G ist the 7th column)
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static old_column As Integer
If Target.Column <> 7 Then
If old_column = 7 Then
MsgBox "you just exited column G"
End If
End If
old_column = Target.Column
End Sub
 
Top