Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello folks,
when the selection has changed in the grid the Event SheetSelectionChange is thrown. Is there a possibility to tell what cell was previosly selected? Thanks, Anton |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Anton,
You can keep track of it yourself: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Static OldCell As Range If Not OldCell Is Nothing Then ' not first time MsgBox "The old cell is " & OldCell.Address _ & "And it contained " & OldCell End If Set OldCell = Target End Sub Your code goes where the MsgBox line is. You use the OldCell object as a range. It's the previous cell. -- Earl Kiosterud www.smokeylake.com "Anton Sommer" wrote in message ... Hello folks, when the selection has changed in the grid the Event SheetSelectionChange is thrown. Is there a possibility to tell what cell was previosly selected? Thanks, Anton |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Anton,
It occurs to me that the old multiple-cell selection would confound this. You might want to change the last line to: Set OldCell = ActiveCell Earl Kiosterud www.smokeylake.com "Earl Kiosterud" wrote in message ... Anton, You can keep track of it yourself: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Static OldCell As Range If Not OldCell Is Nothing Then ' not first time MsgBox "The old cell is " & OldCell.Address _ & "And it contained " & OldCell End If Set OldCell = Target End Sub Your code goes where the MsgBox line is. You use the OldCell object as a range. It's the previous cell. -- Earl Kiosterud www.smokeylake.com "Anton Sommer" wrote in message ... Hello folks, when the selection has changed in the grid the Event SheetSelectionChange is thrown. Is there a possibility to tell what cell was previosly selected? Thanks, Anton |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Event Macro - Hyperlink selected | Excel Discussion (Misc queries) | |||
Is there a way to call selected sheet's name from on deactivate event? | Excel Programming | |||
SheetSelectionChange | Excel Programming | |||
SheetSelectionChange Target size Limitation? | Excel Programming | |||
VB code to find the selected cell | Excel Programming |