Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Keep cell selection

Hello NG

In a excel sheet i have 5 buttons. Colored red, green, blue, yellow and
purple.

The user must select some celles on the sheet and then click on a button.
The click should call a VBA code and place the button backcolor in the
selected cells.

My problem is that when the user clicks the button, the selected cells
disappears.
Is there a way to hold the selection until the user has clicked a button?

Kind regards

Johnny E. Jensen

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Keep cell selection

If you use CommandButton's from the Control Toolbox toolbar, then you can
set its TakeFocusOnClick property to False... do this will keep the cell
selection selected when the CommandButton's is clicked.

--
Rick (MVP - Excel)


"Johnny E. Jensen" wrote in message
...
Hello NG

In a excel sheet i have 5 buttons. Colored red, green, blue, yellow and
purple.

The user must select some celles on the sheet and then click on a button.
The click should call a VBA code and place the button backcolor in the
selected cells.

My problem is that when the user clicks the button, the selected cells
disappears.
Is there a way to hold the selection until the user has clicked a button?

Kind regards

Johnny E. Jensen


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default Keep cell selection

'Add this line to the start of your sub
cOldSelection = Selection.Address

' Add this one as the last line of your sub
Range(cOldSelection).Select


--
If the post is helpful, please consider donating something to an animal
charity on my behalf.


"Johnny E. Jensen" wrote:

Hello NG

In a excel sheet i have 5 buttons. Colored red, green, blue, yellow and
purple.

The user must select some celles on the sheet and then click on a button.
The click should call a VBA code and place the button backcolor in the
selected cells.

My problem is that when the user clicks the button, the selected cells
disappears.
Is there a way to hold the selection until the user has clicked a button?

Kind regards

Johnny E. Jensen

.

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
Limiting selection in a cell AND linking that selection to a list Lisa Excel Discussion (Misc queries) 1 July 28th 09 05:00 PM
Copy Selection - Paste Selection - Delete Selection Uninvisible Excel Programming 2 October 25th 07 01:31 PM
How to create a selection list then display the selection in a cell [email protected] Excel Programming 0 August 1st 07 03:01 PM
Change from Column Selection to Cell Selection Lil Pun[_16_] Excel Programming 4 June 16th 06 10:38 PM
limit cell list selection based on the selection of another list lorraine Excel Worksheet Functions 2 December 14th 04 08:17 PM


All times are GMT +1. The time now is 08:50 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"