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

كود يعطى رساله خطأ compile error


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

السلام عليكم 

هذا الكود يعطى رساله خطا

compile error

Block if without end if 

Private Sub CmdSaveChanges_Click() 'edit
ThisWorkbook.Activate
If Me.TextBox1.Value = "" Then
If Me.TextBox2.Value = "" Then
If Me.TextBox3.Value = "" Then
If Me.ComboBox5.MatchFound = False Then
'====check date entry '==
dtval = Val(Format(Me.TextBox2.Value, "0"))
mindt = 40909
maxdt = Val(Format(Date + 1, "0"))
If dtval < mindt Then
If dtval > maxdt Then

End If
 With Sheet13

invs = Me.ComboBox5.Value
invn = Me.TextBox1.Value

fc = Application.WorksheetFunction.CountIfs(Sheet13.Range("C2:C5000"), invs, Sheet13.Range("B2:B5000"), invn)
If fc < 1 Then: MsgBox " ÑÞã ÇáÍÑßÉ åÐÇ ÛíÑ ãæÌæÏ Çæ ãßÑÑ ÝÖáÇ ÊÇßÏ ãä ÇáÑÞã  ", vbCritical, "FADEL NASSER ": Exit Sub

confir = MsgBox("åá ÊÑíÏ ÍÝÙ ÇáÊÚÏíáÇÊ Úáì ÇáÍÑßÉ...  ¿", vbOKCancel, "FADEL NASSER  ")
If confir = vbCancel Then: Exit Sub

Application.ScreenUpdating = False

  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("j2").Value _
Or invs = shSupport.Range("j3").Value Then
   Me.TextBox3.Text = .Cells(lastrow, "F")  'madfoaat sanad
   Me.TextBox6.Value = .Cells(lastrow, "E") 'khasm

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

     
End If
 End With
 Me.TextBox2.Value = Format(Date, "yyyy/mm/dd")
 Me.TextBox1.Text = ""
 Me.ComboBox5.Text = ""
 Me.ComboBox1.Text = ""
 Me.ComboBox6.Text = ""
 Me.TextBox3.Text = ""
 Me.Label24.Caption = ""
 Me.TextBox7.Text = ""
 Me.TextBox6.Text = ""
 Me.ComboBox4.Value = invs
 Me.TextBox10.Value = invn
 CmdSearchHaraka_Click
 MsgBox " ÊãÊ ÚãáíÉ ÊÚÏíá ÇáÍÑßÉ ÈäÌÇÍ "
 Application.ScreenUpdating = True

End Sub

 

01-00001.xlsm

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

وجب عليك  ان ترفق  الملف  حتى  الاساتدة يساعدوك  ليتم التجربة على الملف 

يحدث هذا الخطأ بسبب بيان غير مكتمل. هذا الخطأ له سبب والحل كالتالي:

يتم استخدام تعليمة If بدون عبارة End If المقابلة. يجب أن تنتهي عبارة If متعددة الأسطر بعبارة End If مطابقة. بالنسبة إلى عبارات If ... End If المتداخلة ، تأكد من وجود بنية If ... متطابقة بشكل صحيح ضمن حلقة  If ... End If

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

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