excel vba code to find value in a column are slow, how do i make it faster? -


my vba code below, how faster ? (obs: have +- 33000 lines of values) search codes products company, need faster.

private sub textbox1_enter() dim findstring string dim rng range findstring = textbox1.text if trim(findstring) <> "" , len(textbox1.text) = 6    sheets("cadmat").range("b:b") 'searches of column b         set rng = .find(what:=findstring, _                     after:=.cells(.cells.count), _                     lookin:=xlvalues, _                     lookat:=xlwhole, _                     searchorder:=xlbyrows, _                     searchdirection:=xlnext, _                     matchcase:=false)     if not rng nothing         dim ultimalinha object         set ultimalinha = plan3.range("a35565").end(xlup)         ultimalinha.offset(1, 0).value = textbox1.text         ultimalinha.offset(1, 1).value = textbox2.text         textbox1.text = ""         textbox2.text = ""         textbox1.setfocus     else         msgbox "produto não existe na tabela!" 'value not found         textbox1.text = ""         textbox2.text = ""         textbox1.setfocus     end if end end if end sub 

option explicit

private sub textbox1_enter()

application.screenupdating = false

code here ...

application.screenupdating = true

end sub


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -