Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Selected cells become deselected?

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Selected cells become deselected?

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




  #3   Report Post  
Posted to microsoft.public.excel.programming
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






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selected cells become deselected?

I am having the same issue. Anyone have any ideas

--
Message posted from http://www.ExcelForum.com

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
Multiple cells or columns are selected instead of selected cell or Mikey Excel Discussion (Misc queries) 1 April 29th 09 09:48 PM
Excel 2003, when I click on a particular cell it gets deselected towinwin New Users to Excel 1 September 29th 06 03:41 PM
Cells are selected but aren't displayed as selected Nifty Excel Discussion (Misc queries) 2 September 17th 06 07:22 PM
Cells are selected but aren't displayed as selected Nifty Excel Worksheet Functions 0 September 17th 06 11:34 AM
A validated List which link to selected cells according to what is selected on the list WL Excel Worksheet Functions 1 June 5th 06 08:52 PM


All times are GMT +1. The time now is 04:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"