Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Select all/Deselect all button in a form

How can I code a button which will allow the user
to select/deselect all entries in a multiselect listbox,
please?

Currently Textbox1 instructs the user to use the left
mouse button to highlight their chosen sheets,
Listbox1 contains the sheet names, and Command
Button1 = "Click when done".

I'm hoping that when a book contains many sheets,
user could select all then just left click with mouse to
deselect specific sheets.

Is this possible, please?

Regards.





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.505 / Virus Database: 302 - Release Date: 30/07/2003


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Select all/Deselect all button in a form

Hi Stuart,

If you set the MultiSelect property of the ListBox to "2 -
fmMultiSelectExtended" then the ListBox will behave like this for you
automatically. Selecting the first item in the list and then holding down
the Shift key while selecting the last item in the list will select all
items in the list. Then holding down the Ctrl key while clicking on specific
list items will unselect them.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Stuart" wrote in message
...
How can I code a button which will allow the user
to select/deselect all entries in a multiselect listbox,
please?

Currently Textbox1 instructs the user to use the left
mouse button to highlight their chosen sheets,
Listbox1 contains the sheet names, and Command
Button1 = "Click when done".

I'm hoping that when a book contains many sheets,
user could select all then just left click with mouse to
deselect specific sheets.

Is this possible, please?

Regards.





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.505 / Virus Database: 302 - Release Date: 30/07/2003




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Select all/Deselect all button in a form

for i = 0 to listbox1.Listcount-1
listbox1.Selected(i) = False
Next

False will unselect. Change to True to select.

Regards,
Tom Ogilvy


"Stuart" wrote in message
...
How can I code a button which will allow the user
to select/deselect all entries in a multiselect listbox,
please?

Currently Textbox1 instructs the user to use the left
mouse button to highlight their chosen sheets,
Listbox1 contains the sheet names, and Command
Button1 = "Click when done".

I'm hoping that when a book contains many sheets,
user could select all then just left click with mouse to
deselect specific sheets.

Is this possible, please?

Regards.





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.505 / Virus Database: 302 - Release Date: 30/07/2003




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
Deselect B1 & move curser to select A1 aussiegirlone Excel Discussion (Misc queries) 2 July 10th 09 03:00 AM
select all, deselect these md[_2_] Excel Discussion (Misc queries) 1 March 2nd 08 03:08 PM
When I select a cell in Excel I cannot deselect it. Ideas? John789 Excel Discussion (Misc queries) 6 September 16th 06 05:34 PM
How to select and deselect rows in Excel Gallant Excel Discussion (Misc queries) 2 July 4th 05 08:10 PM
How to select and deselect rows in Excel Gallant Excel Discussion (Misc queries) 1 July 4th 05 01:59 AM


All times are GMT +1. The time now is 02:48 PM.

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

About Us

"It's about Microsoft Excel"