下面的我的vba代码,它如何更快? (obs:我有+ - 33000行值) 我搜索从产品到我公司的代码,我需要帮助才能更快地完成。
Private Sub TextBox1_Enter()
Dim FindString As String
Dim Rng As Range
FindString = TextBox1.Text
If Trim(FindString) <> "" And Len(TextBox1.Text) = 6 Then
With Sheets("CADMAT").Range("B:B") 'searches all 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 Is Nothing Then
Dim ultimalinha As 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 With
End If
End Sub
答案 0 :(得分:0)
选项明确
Private Sub TextBox1_Enter()
Application.ScreenUpdating = False
这里的代码......
Application.ScreenUpdating = True
End Sub