Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Slow 'FIND' when entering a value in Combobox
Hi, I'm somewhat puzzeld by the following behaviour of my code (not really proficient in Excel-VBA). I've created a form with, amongst others, a combobox from which I can select a record from a dropdown list and have the other form fields populated with the details from the selected row. In the combobox I can also enter a value. A 'Change' event then triggers a find for the value entered. If the value is found then the form fields are populated, else I supply a value tho the other fields in the form to add a new record to the database. The problem is that the 'find' when manually entering a value in the combobox seems very slow (especially when the value does not exist in the db). Below the part of the code does does the find Could someone explain me/correct what is wrong/missing in this code? Thks a lot! Eric -- Private Sub cboEnvelopeID_Change() Dim EnvelopeCode2 As String Set EnvelopeCode1 = Nothing cboEnvelopeID.MatchEntry = fmMatchEntryComplete Dim rFoundRecord As Range Set rFoundRecord = Range("A2") With ActiveSheet.Range("A2:A500") EnvelopeCode2 = cboEnvelopeID.Value Set rFoundRecord = Columns(1).Find(What:=EnvelopeCode2, _ After:=rFoundRecord, Lookin:=xlValues, LookAt:=xlWhole, _ SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) If cboEnvelopeID.MatchFound = True Then rFoundRecord.Rows.EntireRow.Select btnEnvelopeAdd.Enabled = False btnEnvelopeDelete.Enabled = True btnEnvelopeModify.Enabled = True iEnvelopeRowNumber = ActiveCell.Row iEnvelopeRowNumber = iEnvelopeRowNumber - 1 Call GetEnvelopeData oldEnvelopeID = cboEnvelopeID.Value Else Call ClearFields cboEnvelopeID.Value = EnvelopeCode2 btnEnvelopeAdd.Enabled = True btnEnvelopeClear.Enabled = True btnEnvelopeDelete.Enabled = False btnEnvelopeModify.Enabled = False End If End With End Sub -- bdn435 ------------------------------------------------------------------------ bdn435's Profile: http://www.excelforum.com/member.php...o&userid=33817 View this thread: http://www.excelforum.com/showthread...hreadid=535906 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Entering data slow program down | New Users to Excel | |||
entering time via combobox | Excel Discussion (Misc queries) | |||
Avoid re-entering 'Find what:' | Excel Discussion (Misc queries) | |||
Entering Values into Combobox in Spreadsheet | Excel Discussion (Misc queries) | |||
ComboBox - Entering Text | Excel Programming |