ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA How to Reset a List box (https://www.excelbanter.com/excel-programming/351695-vba-how-reset-list-box.html)

wejofost

VBA How to Reset a List box
 

I have a user Data Entry FORM where the user must input 14 values.
Only one of the 14 values is a list box ( where the user can select one
value from the list) the other 13 being a mixture of Text and numeric
input.
If the user makes a serious mistake and wants to restart from scratch
they can use the CANCEL button to clear down all the data they have
entered and start again.
The 13 data field sare clearing down OK BUT how do I reset the list box
back to the start of the list of choices?

Grrrrrrr. Can't find this info any where!

Help please!


--
wejofost
------------------------------------------------------------------------
wejofost's Profile: http://www.excelforum.com/member.php...o&userid=30917
View this thread: http://www.excelforum.com/showthread...hreadid=505934


Rick Hansen

VBA How to Reset a List box
 
Hello wejofost,

try
Me.ListBox.Clear (this completely clear the listbox)

then re-initialize the listbox by using the addItem method

Rick

"wejofost" wrote in
message ...

I have a user Data Entry FORM where the user must input 14 values.
Only one of the 14 values is a list box ( where the user can select one
value from the list) the other 13 being a mixture of Text and numeric
input.
If the user makes a serious mistake and wants to restart from scratch
they can use the CANCEL button to clear down all the data they have
entered and start again.
The 13 data field sare clearing down OK BUT how do I reset the list box
back to the start of the list of choices?

Grrrrrrr. Can't find this info any where!

Help please!


--
wejofost
------------------------------------------------------------------------
wejofost's Profile:

http://www.excelforum.com/member.php...o&userid=30917
View this thread: http://www.excelforum.com/showthread...hreadid=505934




wejofost[_2_]

VBA How to Reset a List box
 

Here is the Cleardata function.

I tried Me.ListBox.Clear but it doesn't crack it.

Here is the code. First line of List Box data ( Select location ) is in
A100.

Private Sub ClearData()
' Clear down all data fields before user starts input.
'
' lstTCRef.Text = Cells(a100)
txtArticle.Text = ""
txtQty.Text = ""
txtOriginalROP.Text = ""
txtOriginalTS.Text = ""
txtNewROP.Text = ""
txtNewTS.Text = ""
' Me.ListBox.Clear
' Me.lstTCRef.Clear

End Sub


Any Clues?
Thank you for your help.

Wej Parry


--
wejofost
------------------------------------------------------------------------
wejofost's Profile: http://www.excelforum.com/member.php...o&userid=30917
View this thread: http://www.excelforum.com/showthread...hreadid=505934



All times are GMT +1. The time now is 05:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com