Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Responding to cell events in Excel

Hello

I want to do the following:

A) When I move away from a cell - ie by tabbing or moving with mouse - I
want to be able to check the contents of the previously selected cell.

B) When I move away from a cell - as above - I want to be able to check the
contents of the cell moved to.

So I need a BeforeMoveAway event and a JustMovedToCell event or similar.

Can anyone help because I am finding this tricky

Angus Comber




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Responding to cell events in Excel

Angus,

Use the SelectionChange event procedure. Put the following code in the code
module for the appropriate worksheet.


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static PrevRange As Range
If Not PrevRange Is Nothing Then
MsgBox "PrevRange: " & PrevRange.Address & vbCrLf & _
"Current Range: " & Target.Address
End If
Set PrevRange = Target
End Sub

PrevRange will refer to the cell that was selected before changing the
selection, and Target will refer to the currently selected range.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Angus Comber" wrote in message
...
Hello

I want to do the following:

A) When I move away from a cell - ie by tabbing or moving with mouse - I
want to be able to check the contents of the previously selected cell.

B) When I move away from a cell - as above - I want to be able to check

the
contents of the cell moved to.

So I need a BeforeMoveAway event and a JustMovedToCell event or similar.

Can anyone help because I am finding this tricky

Angus Comber






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel not responding iranuc Charts and Charting in Excel 1 May 6th 09 04:12 AM
Cell change events Richard Excel Discussion (Misc queries) 2 May 16th 07 04:18 PM
Cell is not responding to wordtext Stressedout Excel Worksheet Functions 1 November 14th 04 09:15 AM
Events with cell link Jussi Peltonen Excel Programming 0 October 17th 03 08:05 AM
Events for cell deletion Aaron Queenan Excel Programming 5 July 16th 03 01:33 PM


All times are GMT +1. The time now is 06:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"