PDA

View Full Version : numbers match in combobox



white_flag
05-10-2011, 06:27 AM
hello

I have this problem and I do not know how to fix it:

I have an userform in Word, this is made from 10 comboboxes. The values from comboboxes are been taket from an excel file like this: Combo1=range("A2:A456") etc. In word (user form), I see the list from excel. but wen I type an number I like that, the combobox to show me match values. but nothing. This is happening just with the numbers, with letter it is going good. The setings from excel are for all the same. I try diffrent combination in combobox.properties but nothing. What can I do? The numbers in combo are important

this is the code:

option explicit

Private Sub ComboBoxA1_Change()
Dim i As Integer
For i = 1 To 9
Controls("ComboBoxA" & i).ListIndex = ComboBoxA1.ListIndex
Next
End Sub

Private Sub ComboBoxA2_Change()
Dim i As Integer
For i = 1 To 9
Controls("ComboBoxA" & i).ListIndex = ComboBoxA2.ListIndex
Next
End Sub

.
.
.

Private Sub ComboBoxA9_Change()
Dim i As Integer
For i = 1 To 9
Controls("ComboBoxA" & i).ListIndex = ComboBoxA9.ListIndex
Next
End Sub
Private Sub from_excel()
With GetObject("D:\ooo.xls")
ComboBoxA1.List = .sheets(1).Range("B2:B456").Value
ComboBoxA2.List = .sheets(1).Range("K2:K456").Value
ComboBoxA3.List = .sheets(1).Range("W2:W456").Value
ComboBoxA4.List = .sheets(1).Range("Y2:Y456").Value
ComboBoxA5.List = .sheets(1).Range("L2:L456").Value
ComboBoxA6.List = .sheets(1).Range("M2:M456").Value
ComboBoxA7.List = .sheets(1).Range("P2:P456").Value
ComboBoxA8.List = .sheets(1).Range("D2:D456").Value 'numbers - not going
ComboBoxA9.List = .sheets(1).Range("B2:B456").Value 'numbers - not going
.Close False
End With
End Sub

Private Sub UserForm_Initialize()
from_excel
End Sub