View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones[_2_] Norman Jones[_2_] is offline
external usenet poster
 
Posts: 421
Default retain Selection

Hi Dr Fear,


Try something like

'==========
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng As Range
Dim rCell As Range

Set WB = ActiveWorkBook
Set Rng = Selection
Set rCell = ActiveCell

' \\ Your code

Application.Goto Reference:=Rng
rCell.Activate

End Sub
'<==========



---
Regards.
Norman


"DrFear" wrote in message
...
I'm trying to restore the Selection that was in place at the time I
started a
routine that changes the selection during its run. In other words I want
something like

dim saveSel as Range
Set saveSel = Application.Selection

... do stuff that destroys the current selection then

saveSel.Select

And the problem with this is of course that the object to which saveSel
refers has been destroyed in the meantime. What I actually want is to
have
saveSel be a range (or ref to a range) of cells that is set to whatever
was
selected originally.

Any ideas?