View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Holmes Bob Holmes is offline
external usenet poster
 
Posts: 13
Default Selected cells become deselected?

Thanks Tom. That is exactly what I needed.
Every day I learn a lot more about Excel. The most important thing I've
learned is that there is so much more that I don't know about it. Thank God
for people like you helping out those of us who need the help.

--
Bob Holmes

"Tom Ogilvy" wrote in message
...
I think you would have to disable the event to do this

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if application.CutCopyMode = True then exit sub
If blnSaving = True Then Call Check_Existing_Codes(Target)
cmbNewWorkCode.Visible = False
'more code here
End Sub

--
Regards,
Tom Ogilvy


"Bob Holmes" wrote in message
...
I'm using a worksheet as a front-end for some data entry. I have code

in
the 'worksheet_selectionchange' event that enables/disables command

buttons
and comboboxes on the sheet based on the column in which the user places

the
cursor. I am finding that after selecting some cells for copying, that

the
selection goes away as soon as I reach code in this event that is

related
to
the command button or any object on the worksheet, which means that

there
is
nothing to paste.
Here is a sample of my code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If blnSaving = True Then Call Check_Existing_Codes(Target)
cmbNewWorkCode.Visible = False
'more code here
End Sub

I select cells, choose to copy the selection and then select the cell

where
it should paste. Upon selecting the cell for pasting, this routine is
triggered and the first line causes no problems since it is only

checking
the value of a variable. Upon execution of the second line, the

selection
disappears and the paste feature is disabled.
I'm certain that this is where I need to place this code, since I need

to
know as soon as the user has selected a cell in order to determine where

the
cursor is. Is there some way to maintain the selection even though the

code
is working on objects on the sheet. Does anyone have any suggestions.

I'm
willing to try anything. Thanks for any help you can offer.
--
Bob Holmes