Selection Change Event...

  • Thread starter Thread starter Juan Sanchez
  • Start date Start date
J

Juan Sanchez

Hi All

Does anyone knows if on a "Selection Change" event I can
retrieve the previos active cell??? say I'm on A1 and then
I hit the Left arrow towards A2, is there a way to know
that previosly I was in A1. What if I'm in A1 and then I
go directly to C10 with the mouse, once the selection
change occurs, is it possible to now what the seleciton
was before??

Any help is greatly appreciated...

Regards
JS
 
Hi
you have to store the old cell in a static variable. something like

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
static old_range as range
if old_range is nothing then
set old_range = target
else
'do your code
msgbox "Old cell: " & old_range.address
end if
set old_range = target

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top