|
-
Aug 29th, 2003, 10:08 PM
#1
Thread Starter
Fanatic Member
Event which fires when moving from one cell to another in Excel
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?
-
Aug 29th, 2003, 10:39 PM
#2
Fanatic Member
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
"Look! Up in the sky! It's a bird! It's a plane! It's Diaper-Head Boy! (there by my name!) Yes, Diaper-Head Boy, who disguised as my son, Seth, fights a never-ending battle for truth, justice and terrorizing my house!
Resistance is futile, you will be compiled . . . Please!
-
Aug 29th, 2003, 10:56 PM
#3
Thread Starter
Fanatic Member
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.
-
Aug 29th, 2003, 11:01 PM
#4
Fanatic Member
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.
"Look! Up in the sky! It's a bird! It's a plane! It's Diaper-Head Boy! (there by my name!) Yes, Diaper-Head Boy, who disguised as my son, Seth, fights a never-ending battle for truth, justice and terrorizing my house!
Resistance is futile, you will be compiled . . . Please!
-
Aug 29th, 2003, 11:08 PM
#5
Thread Starter
Fanatic Member
No. This will do. Thanks very much.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|