Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default SelectionChange event

When I change selectio in a worksheet, the range that I select is passed to
the SelectionChange event as Target. How can I identify the range that I have
changed from?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default SelectionChange event

You would need to put in a static variable in the selectionchange event and
update it as you exit the selectionchange event.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim oldSelection as Static

' code that does things


set OldSelection = Target

End Sub

if you will have to use this value on the very first selectionchange, then
you will need to make it a public variable in a general module and
initialize it in the Workbook_Open event.

--
Regards,
Tom Ogilvy


"Hayeso" wrote in message
...
When I change selectio in a worksheet, the range that I select is passed

to
the SelectionChange event as Target. How can I identify the range that I

have
changed from?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default SelectionChange event

Thanks Tom, That makes sense.

"Tom Ogilvy" wrote:

You would need to put in a static variable in the selectionchange event and
update it as you exit the selectionchange event.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim oldSelection as Static

' code that does things


set OldSelection = Target

End Sub

if you will have to use this value on the very first selectionchange, then
you will need to make it a public variable in a general module and
initialize it in the Workbook_Open event.

--
Regards,
Tom Ogilvy


"Hayeso" wrote in message
...
When I change selectio in a worksheet, the range that I select is passed

to
the SelectionChange event as Target. How can I identify the range that I

have
changed from?




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
how to use selectionchange instead of doubleclick event? ghost Excel Discussion (Misc queries) 0 December 24th 08 05:00 AM
Worksheet SelectionChange Event mjack003 Excel Discussion (Misc queries) 2 May 8th 06 08:35 PM
Worksheet SelectionChange event [email protected] Excel Programming 6 June 24th 05 12:51 AM
SelectionChange event Stefi Excel Programming 2 October 28th 04 01:26 PM
SelectionChange Event Squid[_3_] Excel Programming 5 February 11th 04 01:57 PM


All times are GMT +1. The time now is 08:31 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"