ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   list box (https://www.excelbanter.com/excel-programming/271208-list-box.html)

Joe[_17_]

list box
 
I would like the code to insert a name into a list box if
the check box is checked and remove it if it is
deselected. How could I do this.

thanks in advance.

Joe

Private Sub CheckBox1_Click()


If count Mod 2 = 0 Then
List.AddItem "Manning, Joe"
Else
List.RemoveItem (List.ListCount)
End If
count = count + 1


End Sub

Derek[_2_]

list box
 
Try using the Checkbox1_AfterUpdate() event with the
following logic:

Private Sub cbxEnablePipette2_AfterUpdate()
If Checkbox1.value = true then
'add the item
Else
'remove the item
End If
End Sub

Hope that helps...

-----Original Message-----
I would like the code to insert a name into a list box if
the check box is checked and remove it if it is
deselected. How could I do this.

thanks in advance.

Joe

Private Sub CheckBox1_Click()


If count Mod 2 = 0 Then
List.AddItem "Manning, Joe"
Else
List.RemoveItem (List.ListCount)
End If
count = count + 1


End Sub
.


Chong Moua

list box
 
Hi Joe,

Not sure if this is what you want, but try this... not
tested...
------------------------------
Private Sub CheckBox1_Click()

If CheckBox1 = True Then
ListBox1.AddItem "Manning, Joe"
Else
ListBox1.RemoveItem "Manning, Joe"
End If

End Sub
--------------------------------
Hope this helps...

Chong Moua

-----Original Message-----
I would like the code to insert a name into a list box if
the check box is checked and remove it if it is
deselected. How could I do this.

thanks in advance.

Joe

Private Sub CheckBox1_Click()


If count Mod 2 = 0 Then
List.AddItem "Manning, Joe"
Else
List.RemoveItem (List.ListCount)
End If
count = count + 1


End Sub
.


Joe[_17_]

list box
 
I get an error when i try to use
listbox1.removeitem "manning, joe"

any other suggestions?

Thanks

Joe
-----Original Message-----
Hi Joe,

Not sure if this is what you want, but try this... not
tested...
------------------------------
Private Sub CheckBox1_Click()

If CheckBox1 = True Then
ListBox1.AddItem "Manning, Joe"
Else
ListBox1.RemoveItem "Manning, Joe"
End If

End Sub
--------------------------------
Hope this helps...

Chong Moua

-----Original Message-----
I would like the code to insert a name into a list box

if
the check box is checked and remove it if it is
deselected. How could I do this.

thanks in advance.

Joe

Private Sub CheckBox1_Click()


If count Mod 2 = 0 Then
List.AddItem "Manning, Joe"
Else
List.RemoveItem (List.ListCount)
End If
count = count + 1


End Sub
.

.


Chong Moua

list box
 
Joe, this should work...
----------------------
Private Sub CheckBox1_Click()

If CheckBox1 = True Then
ListBox1.AddItem "Manning, Joe", 1
Else
ListBox1.RemoveItem 1
End If

End Sub
----------------------
Chong Moua

-----Original Message-----
I get an error when i try to use
listbox1.removeitem "manning, joe"

any other suggestions?

Thanks

Joe
-----Original Message-----
Hi Joe,

Not sure if this is what you want, but try this... not
tested...
------------------------------
Private Sub CheckBox1_Click()

If CheckBox1 = True Then
ListBox1.AddItem "Manning, Joe"
Else
ListBox1.RemoveItem "Manning, Joe"
End If

End Sub
--------------------------------
Hope this helps...

Chong Moua

-----Original Message-----
I would like the code to insert a name into a list box

if
the check box is checked and remove it if it is
deselected. How could I do this.

thanks in advance.

Joe

Private Sub CheckBox1_Click()


If count Mod 2 = 0 Then
List.AddItem "Manning, Joe"
Else
List.RemoveItem (List.ListCount)
End If
count = count + 1


End Sub
.

.

.



All times are GMT +1. The time now is 07:26 AM.

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