سلام من می خوام داخل این کد از ورک wbMasterاستفاده کنم ولی این اتفاق نمیوفته ممنون میشم راهنمایی بفرمایید دستور در حالت کی پریز تکس باکس بایستی اتفاق بیفته
Private Sub TextBox1_keyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Dim wbMaster As Workbook
Dim sh As Worksheet
Set sh = wbMaster.Sheets("sheet1")
sh.Activate
With sh.Range("E2:E20")
Set D = .Find(userform1.TextBox1.Text, LookIn:=xlValues, LookAt:=xlPart)
If Not D Is Nothing Then
firstAddress1 = D.Address
Do
userform1.ListBox1.AddItem D.Row
userform1.ListBox1.List(userform1.ListBox1.ListCou nt - 1, 3) = D.Offset(0, 0).Value
userform1.ListBox1.List(userform1.ListBox1.ListCou nt - 1, 2) = D.Offset(0, -3).Value
userform1.ListBox1.List(userform1.ListBox1.ListCou nt - 1, 4) = D.Offset(0, -2).Value
userform1.ListBox1.List(userform1.ListBox1.ListCou nt - 1, 0) = D.Offset(0, 3).Value
userform1.ListBox1.List(userform1.ListBox1.ListCou nt - 1, 1) = D.Offset(0, -1).Value
Set D = .FindNext(D)
Loop While Not D Is Nothing And D.Address <> firstAddress1
End If
End With
End Sub
[/CODE]
Private Sub TextBox1_keyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Dim wbMaster As Workbook
Dim sh As Worksheet
Set sh = wbMaster.Sheets("sheet1")
sh.Activate
With sh.Range("E2:E20")
Set D = .Find(userform1.TextBox1.Text, LookIn:=xlValues, LookAt:=xlPart)
If Not D Is Nothing Then
firstAddress1 = D.Address
Do
userform1.ListBox1.AddItem D.Row
userform1.ListBox1.List(userform1.ListBox1.ListCou nt - 1, 3) = D.Offset(0, 0).Value
userform1.ListBox1.List(userform1.ListBox1.ListCou nt - 1, 2) = D.Offset(0, -3).Value
userform1.ListBox1.List(userform1.ListBox1.ListCou nt - 1, 4) = D.Offset(0, -2).Value
userform1.ListBox1.List(userform1.ListBox1.ListCou nt - 1, 0) = D.Offset(0, 3).Value
userform1.ListBox1.List(userform1.ListBox1.ListCou nt - 1, 1) = D.Offset(0, -1).Value
Set D = .FindNext(D)
Loop While Not D Is Nothing And D.Address <> firstAddress1
End If
End With
End Sub
[/CODE]