Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default listbox - How to reset the values

Hello Gurus - I have written a macro on the back of a listbox button that
allows the user to select a worksheet to update. However, once a selection is
made the list box retains this choice so the user cannot select the same
choice again. How do I reset the listbox so none of the options are selected?

Thank you in advance!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 415
Default listbox - How to reset the values

Set its .ListIndex to -1

NickHK

"NezRhodes" ...
Hello Gurus - I have written a macro on the back of a listbox button that
allows the user to select a worksheet to update. However, once a selection
is
made the list box retains this choice so the user cannot select the same
choice again. How do I reset the listbox so none of the options are
selected?

Thank you in advance!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default listbox - How to reset the values

Nick

I added this line of script to the end of my macro:

ListBox1.ListIndex = -1

and unfortunately it does not reset the listbox. Can you clarify your answer
a little please?

"NickHK" wrote:

Set its .ListIndex to -1

NickHK

"NezRhodes" ...
Hello Gurus - I have written a macro on the back of a listbox button that
allows the user to select a worksheet to update. However, once a selection
is
made the list box retains this choice so the user cannot select the same
choice again. How do I reset the listbox so none of the options are
selected?

Thank you in advance!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default listbox - How to reset the values

Private Sub ListBox1_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
ListBox1.ListIndex = -1
End Sub

--
Regards,
Tom Ogilvy


"NezRhodes" wrote in message
...
Nick

I added this line of script to the end of my macro:

ListBox1.ListIndex = -1

and unfortunately it does not reset the listbox. Can you clarify your
answer
a little please?

"NickHK" wrote:

Set its .ListIndex to -1

NickHK

"NezRhodes"
...
Hello Gurus - I have written a macro on the back of a listbox button
that
allows the user to select a worksheet to update. However, once a
selection
is
made the list box retains this choice so the user cannot select the
same
choice again. How do I reset the listbox so none of the options are
selected?

Thank you in advance!






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default listbox - How to reset the values

Great, perfect super, Thanks Tom! (and Nick HK)

"Tom Ogilvy" wrote:

Private Sub ListBox1_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
ListBox1.ListIndex = -1
End Sub

--
Regards,
Tom Ogilvy


"NezRhodes" wrote in message
...
Nick

I added this line of script to the end of my macro:

ListBox1.ListIndex = -1

and unfortunately it does not reset the listbox. Can you clarify your
answer
a little please?

"NickHK" wrote:

Set its .ListIndex to -1

NickHK

"NezRhodes"
...
Hello Gurus - I have written a macro on the back of a listbox button
that
allows the user to select a worksheet to update. However, once a
selection
is
made the list box retains this choice so the user cannot select the
same
choice again. How do I reset the listbox so none of the options are
selected?

Thank you in advance!








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default listbox - How to reset the values

I have used the following:
unload me ' unload userform
UserForm1.Show ' reload same userform, change "UserForm1" with your userform
name

Are there any reasons this is not good to use?

--
Regards

Rick
XP Pro
Office 2007



"Tom Ogilvy" wrote:

Private Sub ListBox1_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
ListBox1.ListIndex = -1
End Sub

--
Regards,
Tom Ogilvy


"NezRhodes" wrote in message
...
Nick

I added this line of script to the end of my macro:

ListBox1.ListIndex = -1

and unfortunately it does not reset the listbox. Can you clarify your
answer
a little please?

"NickHK" wrote:

Set its .ListIndex to -1

NickHK

"NezRhodes"
...
Hello Gurus - I have written a macro on the back of a listbox button
that
allows the user to select a worksheet to update. However, once a
selection
is
made the list box retains this choice so the user cannot select the
same
choice again. How do I reset the listbox so none of the options are
selected?

Thank you in advance!






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default listbox - How to reset the values

I found this answer to reseting the value/position of a List Box, but I think
my requirement is somewhat different. BTW, I am trying to write a 'nimble'
application to run in both Excel 11 and Excel 12, so lewt me know if there
are distinctions in your recommendation.

I am building a record using several entry firelds and several List Boxes.
I am *not* triggering the code on the List Box selection, but have a
CommandButton the user clicks when the entire record is ready to save. After
copying the record to a pseudo-database, I want to clear the entry fields and
reset the List Boxes to their original blank value & position. I did put a
statement for each of the List Boxes in the CommandButton routine of the form:
ListBoxA.ListIndex = -1
but that did not work.

Thanks in advance for the help.

Cheers. dj

"Tom Ogilvy" wrote:

Private Sub ListBox1_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
ListBox1.ListIndex = -1
End Sub

--
Regards,
Tom Ogilvy


"NezRhodes" wrote in message
...
Nick

I added this line of script to the end of my macro:

ListBox1.ListIndex = -1

and unfortunately it does not reset the listbox. Can you clarify your
answer
a little please?

"NickHK" wrote:

Set its .ListIndex to -1

NickHK

"NezRhodes"
...
Hello Gurus - I have written a macro on the back of a listbox button
that
allows the user to select a worksheet to update. However, once a
selection
is
made the list box retains this choice so the user cannot select the
same
choice again. How do I reset the listbox so none of the options are
selected?

Thank you in advance!






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default listbox - How to reset the values

ListBoxA.ListIndex = -1
is kind of odd. Normally, one does:
ListBox1.ListIndex = -1

Maybe something else is going on. Post a sample xls at a shared site like
4shared.com and we will check it if you like.

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
how can i reset excel to its default values? Tiffany Thai Excel Worksheet Functions 1 February 25th 09 11:39 PM
How can I use this VB script to reset my values on other sheets? trilogy[_4_] Excel Programming 1 August 4th 06 05:10 AM
reset values in select cells 1vagrowr Excel Discussion (Misc queries) 1 December 17th 05 09:52 AM
Fill values into a listbox matching selected values from a combobox Jon[_19_] Excel Programming 4 January 25th 05 04:25 PM
Sorting ListBox results or transposing ListBox values to other cells for sorting Rob[_8_] Excel Programming 1 July 9th 03 04:35 AM


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