Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how can i reset excel to its default values? | Excel Worksheet Functions | |||
How can I use this VB script to reset my values on other sheets? | Excel Programming | |||
reset values in select cells | Excel Discussion (Misc queries) | |||
Fill values into a listbox matching selected values from a combobox | Excel Programming | |||
Sorting ListBox results or transposing ListBox values to other cells for sorting | Excel Programming |