Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Entering data slow program down JMM New Users to Excel 2 April 11th 09 04:44 PM
entering time via combobox Atishoo Excel Discussion (Misc queries) 0 February 10th 09 01:40 PM
Avoid re-entering 'Find what:' Gav Excel Discussion (Misc queries) 2 November 19th 07 05:37 PM
Entering Values into Combobox in Spreadsheet Regnab Excel Discussion (Misc queries) 2 May 4th 06 12:57 PM
ComboBox - Entering Text Richard Buttrey[_5_] Excel Programming 3 August 26th 04 05:24 PM


All times are GMT +1. The time now is 12:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"