How do I trap the lost focus event of a cell in Excel. In other words, which is the event that is fired when one moves from one cell to a different cell? Is it the Worksheet object's Change event?
How do I trap the lost focus event of a cell in Excel. In other words, which is the event that is fired when one moves from one cell to a different cell? Is it the Worksheet object's Change event?
This example code goes on the sheet's code page . . .
VB Code:
Dim OldCell As Range Private Sub Worksheet_Activate() Set OldCell = Excel.ActiveCell End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) On Error Resume Next MsgBox "You just moved from " & OldCell.Address & vbCr & _ "You are now on " & Target.Address On Error GoTo 0 Set OldCell = Excel.ActiveCell End Sub
I wanted to be notified when I was leaving a cell. But I can take a leaf from that. May be it is workable. Thanks.
That's what it does! It lets you know when you leave a cell by giving you the address of the cell you just left.
Did you need to keep them on the same cell?
Excel can be modified to do just about anything you need.
No. This will do. Thanks very much.