Hello grand community,
I have 'created' a search on excel (massively with a help of youtube lessons).
Its rather simple and it works
I'm doing a job for a firm that has thousands of registries (2,000 +/-) with 44 columns each.
Private Sub Bot_PesquisarRegistos_Click()
If PesquisarNO = "" Then
' PesquisarNO it's a textbox, this code its on a button next to the textbox (please, see image attached)
MsgBox "Field empty, please write a NO number", vbInformation, "Alert"
PesquisarNO.SetFocus
Else
Range("a6").Select ' before A6 there is lots of things that doesn't matter for the search.
Do
ActiveCell.Offset(1, 0).Select
If ActiveCell.Text = "" Then
MsgBox "No registry found with the NO:" & PesquisarNO & " supplied. Try again", vbInformation, "Alert"
PesquisarNO = ""
PesquisarNO.SetFocus
Exit Sub
End If
Loop Until ActiveCell.Text = PesquisarNO
CarregaDados ' A subrotine that fills with the data on the current line on the excel sheet into the fields on the form.
PesquisarNO = ""
PesquisarNO.SetFocus
End If
End Sub
2.gif
This is very nice but for the first 1,000 records. After that it starts to take too long (5 seconds + ) to find a line that obeys the condition.
My question is... Is there a better way to do a search ? a faster way with some internal function that I don't know about.
Thank you for any help you can give me and thank you for your time in advanced
Orion
Bookmarks