LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default Adding to a ListBox

I have a userform that contains a listbox. Users can add values by entering
number in a textbox and clicking an "add" button. The problem is once a
certain number of entries have been added, the next values appear at the end
of the listbox.

Using the .AddItem method, how do I add values to the beginning of the list?
The code keeps saying it expects an "=" sign.

Code:
Private Sub cbCustomCodeAdd_Click()
With Me
If Not .tbCustomCode.Value = "" Then
For Each item In .lbGathCodes.List
If item = .tbCustomCode.Value Then
.tbCustomCode.Value = ""
Exit Sub
End If
Next item
If Len(.tbCustomCode) 3 Then .tbCustomCode =
Left(.tbCustomCode, 3)
.lbGathCodes.AddItem (.tbCustomCode.Value)
.tbCustomCode.Value = ""
.lbGathCodes.Selected(.lbGathCodes.ListCount - 1) = True
End If
End With
End Sub

 
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
Adding item in listbox volabos Excel Worksheet Functions 0 December 3rd 07 11:47 AM
Adding item in listbox volabos Excel Worksheet Functions 0 December 3rd 07 11:27 AM
Adding Headers to a listbox Mike Milligan Excel Programming 3 October 18th 06 08:48 PM
adding a listbox to a spreadsheet [email protected] Excel Programming 2 October 29th 03 05:45 PM
Adding a row of data to a Listbox Scott Elrod[_2_] Excel Programming 0 August 27th 03 09:43 PM


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