اذهب الي المحتوي
أوفيسنا

ارجو المساعدة فى كود البحث يعطى خطا


إذهب إلى أفضل إجابة Solved by علي المصري,

الردود الموصى بها

يعطى لون اصفر على السطر 

(fc = Application.WorksheetFunction.CountIfs(.Range("C2:C5000"), invs, .Range("B2:B5000"), invn

Private Sub CmdSearchHaraka_Click()
ThisWorkbook.Activate
With Sheet02
invs = Me.ComboBox4.Value
invn = Me.TextBox10.Value

If invs = "" Or invn = "" Then: MsgBox "اختر نوع الحركة او اكتب رقم الحركة  ", vbCritical, "FADEL NASSER ": Exit Sub

(fc = Application.WorksheetFunction.CountIfs(.Range("C2:C5000"), invs, .Range("B2:B5000"), invn
If fc < 1 Then: MsgBox " رقم الحركة هذا غير موجود فضلا تاكد من الرقم  ", vbCritical, "FADEL NASSER " _
: Me.TextBox10.Value = "": Me.TextBox10.SetFocus: Exit Sub

 Application.ScreenUpdating = False


 .Range("$C$1:$I$2").AutoFilter Field:=2, Criteria1:=invs
 .Range("$B$1:$1$2").AutoFilter Field:=1, Criteria1:=invn
 lastrow = .Range("B5000").End(xlUp).row
 .Range("$A$2:$I$2").AutoFilter
 Me.TextBox2.Text = .Cells(lastrow, "A").Value 'date
 Me.TextBox2.Text = Format(Me.TextBox2.Text, "yyyy/mm/dd") 'f date
 Me.TextBox1.Value = .Cells(lastrow, "B").Value 'invn
 Me.ComboBox5 = .Cells(lastrow, "C").Value 'invs
 Me.ComboBox1.Value = .Cells(lastrow, "D") 'customer
 Me.ComboBox6.Text = .Cells(lastrow, "E") 'wazalik
 Me.TextBox3.Text = .Cells(lastrow, "F") 'mandob name
 Me.Label24.Caption = .Cells(lastrow, "G") 'payment method
 Me.TextBox7.Text = .Cells(lastrow, "H") 'bank name
 Me.TextBox6.Text = .Cells(lastrow, "I") 'shiak _no


If invs = shSupport.Range("j3").Value _
Or invs = shSupport.Range("j2").Value Then
   Me.TextBox3.Text = .Cells(lastrow, "F")  'madfoaat sanad
   Me.TextBox6.Value = .Cells(lastrow, "E") 'khasm

ElseIf invs = shSupport.Range("J1").Value _
    Or invs = shSupport.Range("J1").Value Then
       Me.TextBox3.Value = .Cells(lastrow, "F")        'discount bai3 and shera2
     

End If
End With

If Me.Label24.Caption = shSupport.Range("J4").Value Then OptionButton3.Value = True
If Me.Label24.Caption = shSupport.Range("J5").Value Then OptionButton4.Value = True
If Me.Label24.Caption = shSupport.Range("J6").Value Then OptionButton5.Value = True

Me.ComboBox5.Enabled = False
Me.TextBox1.Enabled = False

Application.ScreenUpdating = True
End Sub

 

01-00001.xlsm

رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information