"deselect ?" a range or change state from edit to ?

M

mark kubicki

i have a set of subs that process when a cell is double clicked; they open a
window with information about the contents of the cell

the problem is:

when i close the window, the target cell is in an edit (?) state (the
vertical edit bar is visible within the text),
then when the user clicks (selects) a different cell (there may be no need
for them to edit the text in the target cell), the curser "bounces" back to
the target cell putting it ina selected, but not edit state (?? ...i think
this is what is happening ??) from this point on, a different cell can be
selected and the selection will "stick"

.... frustrating!

i would like the target cell to remain selected when the window is closed
(so the user knows where they were, but not in the edit state (so that when
the user clicks a different cell, they remain with that new choice)

thanks in advance,
mark
 
K

K Dales

You are using the BeforeDoubleClick event, which processes
before Excel executes the action triggered "normally" by a
double-click, which is to edit the cell. So when your
routine is done Excel continues with the double click
action and the cell gets put into edit mode.

To avoid this, use the Cancel parameter to tell Excel not
to process the "normal" double-click action, i.e:

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As
Object, ByVal Target As Range, Cancel As Boolean)

..... Your code goes here ...

Cancel = True

End Sub
 
M

mark kubicki

ah! ... moved the "cancel..." out of the sub and into the "before double
click..." and viola !!
....always, check for the obvious 1st)

thanks
 
Top