![]() |
SheetSelectionChange Event find out previosly selected cell
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 |
SheetSelectionChange Event find out previosly selected cell
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 |
SheetSelectionChange Event find out previosly selected cell
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 |
All times are GMT +1. The time now is 02:28 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com