ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   List box - how to uncheck box (https://www.excelbanter.com/excel-programming/302346-list-box-how-uncheck-box.html)

Anita Gray

List box - how to uncheck box
 
Hello,

I have the following code to accompany a listbox.

My problem is that once a box is checked, it stays checked until I check
another box. I cannot check the same box a second time and have the
associated procedure run. I have to check another box to come back to
the original.

Does anybody know a way around this.

Thanks much,
Anita


Private Sub ListBox1_Click()
If ListBox1.Value = "depreciation" Then
MsgBox "You have chosen to update depreciation"
' Depreciation
ElseIf ListBox1.Value = "salaries" Then
MsgBox "You have chosen to update salaries"

ElseIf ListBox1.Value = "benefit %" Then
MsgBox "you have chosen to update the benefit %, continue?"

ElseIf ListBox1.Value = "payroll tax %" Then
MsgBox "you have chosen to update the payroll tax %, continue?"

ElseIf ListBox1.Value = "Vacation Accrual" Then
MsgBox "You have chosen to update Vacation Accrual"

ElseIf ListBox1.Value = "depreciation and vacation accrual" Then
MsgBox "You have chosen to update depreciation and vacation accrual"
ElseIf ListBox1.Value = "benefit % and payroll tax %" Then
MsgBox "You have chosen to update the benefit and payroll tax %'s"

End If

End Sub

A

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Simon Lloyd[_512_]

List box - how to uncheck box
 
im not sure about this but it might be something to do with setting th
focus like this

ListBox1.Value = ""
Listbox1.Setfocus

Dont take my word for it though as ive only been at this for about
weeks myself.

hope its useful,

Simo

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 06:29 AM.

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