View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Select Method from Combo Box

If you sort your values in the combobox, your should get what you want.
The easiest is to sort then in the worksheet, then load them


Option Explicit

Private Sub CombinedBankNames_Change()
MsgBox CombinedBankNames.Value
boxvalue = CombinedBankNames.Value
Call MoveBankData
End Sub


Private Sub UserForm_Initialize()
Dim rng as Range, rng1 As Range
With Worksheets("BankData")
set rng = .Range("AR2:AR999")
rng.copy Destination:=.Range("IV2")
.Range("IV2:IV999").sort Key1:=.Range("IV2"), _
Header:=xlNo
set rng1 = .Range(.Range("IV2"),.Range("IV2").end(xldown))
Me.CombinedBankNames.List = rng1.Value
.Columns(256).Delete
End With
End Sub

--
Regards,
Tom Ogilvy



"bw" wrote in message
...
My Form uses the following code (shown below).
This code has been working well for me, but I'd like to change it to work

in
a different way.

Currently, I scroll to find the item I want, and then click on it. If I

try
to type the item I want, it selects the first item with the first matching
character in the list.

I would like to be able to type the value I want (to autofill with the
values in the list) and/or to scroll to the item I want with the keyboard,
and then press enter or click to select the item.

Will someone show me how?
Thanks,
Bernie

Option Explicit

Private Sub CombinedBankNames_Change()
MsgBox CombinedBankNames.Value
boxvalue = CombinedBankNames.Value
Call MoveBankData
End Sub

Private Sub UserForm_Initialize()
Dim myCell As Range
For Each myCell In Worksheets("BankData").Range("AR2:AR999").Cells
If myCell.Value = "" Then
'do nothing
Else
Me.CombinedBankNames.AddItem myCell.Value
End If
Next myCell
End Sub