PC Review


Reply
Thread Tools Rate Thread

Autoword Select

 
 
brownti via OfficeKB.com
Guest
Posts: n/a
 
      27th Jul 2007
I am using the code below to select a city from a drop down list. The list
is generated from a range on a worksheet. If i run the userform by itself
when i type a letter it selects the first word in the list that starts with
that letter and so on. However when i show this userform, by method of:
Userform1.show, the "auto complete" doesnt work. Any one know of any reason
this would happen? Do i need to load the userform in a different way?

Private Sub UserForm_Initialize()
Dim MyUniqueList As Variant, i As Long
With Me.ComboBox1
.Clear
.AddItem ""
MyUniqueList = UniqueItemList(Range("ProjectCode!G1:G1000"), True)
For i = 1 To UBound(MyUniqueList)
.AddItem MyUniqueList(i)
Next i
.ListIndex = 0
.AutoWordSelect = True
End With
End Sub
Private Function UniqueItemList(InputRange As Range, HorizontalList As
Boolean) As Variant
Dim cl As Range, cUnique As New Collection, i As Long, uList() As Variant
Application.Volatile
On Error Resume Next
For Each cl In InputRange
If cl.Formula <> "" Then
cUnique.Add cl.value, CStr(cl.value)
End If
Next cl
UniqueItemList = ""
If cUnique.Count > 0 Then
ReDim uList(1 To cUnique.Count)
For i = 1 To cUnique.Count
uList(i) = cUnique(i)
Next i
UniqueItemList = uList
If Not HorizontalList Then
UniqueItemList = Application.WorksheetFunction.Transpose(UniqueItemList)
End If
End If
On Error GoTo 0
End Function

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200707/1

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook Create Message, Select To, Select Conacts- ...No Sort Opti Hyny Microsoft Outlook Contacts 1 9th Jul 2009 08:04 PM
Select report(s) to print via multi-select list box Access 2003 =?Utf-8?B?Z2FqbGowNw==?= Microsoft Access Getting Started 2 8th Nov 2007 02:53 AM
uninstalling client services for netwre to select to select logon and logoff opt Ahsan Windows XP New Users 4 31st May 2006 04:02 PM
SELECT INVALID SELECT STATEMENT TO FORCE ODBC DRIVER TO UNPREPARED STATE Jason Teng Microsoft Windows 2000 2 28th Oct 2003 06:03 PM
Outlook 2003 Email Select Names Type name or select from list nsnews.microsoft.com Microsoft Outlook 2 19th Oct 2003 06:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:59 PM.