LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default combobox problem


Alternatively you can simply use:

If not bFound then cboTest.Additem sTemp

in place of

If Not bFound And cboTest.ListCount 0 Then
ReDim Preserve sList(cboTest.ListCount)
sList(cboTest.ListCount) = sTemp
End If

cboTest.Clear
cboTest.List = sList



"AMDRIT" wrote in message
...

try this:

combobox name is cboTest


Private Sub cboTest_AfterUpdate()

Dim sTemp As String
Dim sList As Variant
Dim iLoop As Integer
Dim bFound As Boolean

sTemp = cboTest.Text

If Len(Trim(sTemp)) 0 Then

If cboTest.ListCount = 0 Then
ReDim sList(0)
sList(0) = sTemp
cboTest.List = sList
Exit Sub
End If

'Replace with copymem api
'copy just the first dimension
ReDim sList(cboTest.ListCount)

For iLoop = 0 To cboTest.ListCount - 1
sList(iLoop) = cboTest.List(iLoop)
Next 'iLoop

'End replace with copymem api

For iLoop = 0 To cboTest.ListCount - 1
If StrComp(sTemp, sList(iLoop), vbTextCompare) = 0 Then
bFound = True
End If
Next 'iLoop

If Not bFound And cboTest.ListCount 0 Then
ReDim Preserve sList(cboTest.ListCount)
sList(cboTest.ListCount) = sTemp
End If

cboTest.Clear
cboTest.List = sList

End If

End Sub


"Rbp9ad" wrote in message
...
I have a userform for entry that has a combobox. Nothing appears in the
drop down list. I would like the combobox to add items enterd into as text
in the drop down menu if they are not already there. Is there a way to do
this?





 
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
ComboBox problem hoyos Excel Discussion (Misc queries) 4 December 10th 09 11:16 AM
Combobox Problem blacktour Excel Programming 4 July 21st 05 12:35 PM
ComboBox Problem MBlake[_2_] Excel Programming 3 July 4th 05 09:11 PM
ComboBox Problem R Avery Excel Programming 4 August 3rd 04 06:24 PM
Combobox Problem Bob Phillips[_7_] Excel Programming 0 July 27th 04 06:28 PM


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