PDA

View Full Version : ComboBox can't typing the value ?



KK1966
07-11-2008, 12:08 AM
hi

can u help to check with the code which I marking wrong as the code can't compliling,
The combobox I can't type a value ?



Private Sub cboName_Change()
Dim rng As Range

On Error GoTo hi
With Sheets("Sheet1")
Set rng = Range(.Cells(1, 1), .Cells(1, 1).End(xlDown)).Value
End With
With rng.Find(cboName.Value, lookat:=xlWhole)

Me.txtCode2.Text = .Cells(Me.cboName.ListIndex + 2, "B").Value
Me.txtAmount2.Text = .Cells(Me.cboName.ListIndex + 2, "C").Value
Exit Sub
hi:
MsgBox ("The words you may typed a wrong")


End With
End Sub

Simon Lloyd
07-11-2008, 12:49 AM
In future please wrap your code in the VBA code tags by highlighting your code then clicking the green VBA button at the top of your post window!

The code you supplied is a combobox change event and will trigger of course when you change the state of it, if you cannot type in the box it will probably be because you have it set in the properties, maybe it has the MatchEntry set wrong or is locked..etc