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

مطلوب تعديل في كود if في هذا الفورم


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

          If Me.ComboBox7.Value = 0 Then
Else
ws.Cells(iRow + 1, 2).Value = Me.TextBox4.Value
ws.Cells(iRow + 1, 3).Value = DateSerial(Year(Me.TextBox1.Value), Month(Me.TextBox1.Value), Day(Me.TextBox1.Value))
ws.Cells(iRow + 1, 4).Value = Me.ComboBox4.Value
ws.Cells(iRow + 1, 8).Value = Me.ComboBox3.Value
ws.Cells(iRow + 1, 13).Value = Me.ComboBox5.Value

If Me.ComboBox8.Value = 0 Then
Else
ws.Cells(iRow + 2, 2).Value = Me.TextBox4.Value
ws.Cells(iRow + 2, 3).Value = DateSerial(Year(Me.TextBox1.Value), Month(Me.TextBox1.Value), Day(Me.TextBox1.Value))
ws.Cells(iRow + 2, 4).Value = Me.ComboBox4.Value
ws.Cells(iRow + 2, 8).Value = Me.ComboBox3.Value
ws.Cells(iRow + 2, 13).Value = Me.ComboBox5.Value
End If
End If

 

المطلوب تعديل الكود السابق بحيث انه اذا لم ادخل قيمة في الكمبو بوكس 7  لايفعل شئ واذا كان هناك قيمة ينفذ الكود اللي بعد else 

ثم اذا كان لايوجد قيمة في كومبو بوكس 8 لايفعل شئ واذا كان هناك قيمة ينفذ الكود اللي بعد else

 

,ومرفق الملف ايضا للتوضيح اكثر

 

16دورة محاسبية.rar

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

وكذلك مطلوب تعديل خانة رقم الفاتورة ليكتب فيها تلقائيا اخر رقم فاتورة وليس رقم اخر صف

ولكم جزيل الشكر

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

السلام عليكم

 

جرب هذا الكود

 

  If not Me.ComboBox7.text =""  Then

ws.Cells(iRow + 1, 2).Value = Me.TextBox4.Value
ws.Cells(iRow + 1, 3).Value = DateSerial(Year(Me.TextBox1.Value), Month(Me.TextBox1.Value), Day(Me.TextBox1.Value))
ws.Cells(iRow + 1, 4).Value = Me.ComboBox4.Value
ws.Cells(iRow + 1, 8).Value = Me.ComboBox3.Value
ws.Cells(iRow + 1, 13).Value = Me.ComboBox5.Value
End If

If not  Me.ComboBox8.text= "" Then

ws.Cells(iRow + 2, 2).Value = Me.TextBox4.Value
ws.Cells(iRow + 2, 3).Value = DateSerial(Year(Me.TextBox1.Value), Month(Me.TextBox1.Value), Day(Me.TextBox1.Value))
ws.Cells(iRow + 2, 4).Value = Me.ComboBox4.Value
ws.Cells(iRow + 2, 8).Value = Me.ComboBox3.Value
ws.Cells(iRow + 2, 13).Value = Me.ComboBox5.Value

End If

 

تحياتي

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

السلام عليكم

 

جرب هذا الكود

 

  If not Me.ComboBox7.text =""  Then

ws.Cells(iRow + 1, 2).Value = Me.TextBox4.Value
ws.Cells(iRow + 1, 3).Value = DateSerial(Year(Me.TextBox1.Value), Month(Me.TextBox1.Value), Day(Me.TextBox1.Value))
ws.Cells(iRow + 1, 4).Value = Me.ComboBox4.Value
ws.Cells(iRow + 1, 8).Value = Me.ComboBox3.Value
ws.Cells(iRow + 1, 13).Value = Me.ComboBox5.Value
End If

If not  Me.ComboBox8.text= "" Then

ws.Cells(iRow + 2, 2).Value = Me.TextBox4.Value
ws.Cells(iRow + 2, 3).Value = DateSerial(Year(Me.TextBox1.Value), Month(Me.TextBox1.Value), Day(Me.TextBox1.Value))
ws.Cells(iRow + 2, 4).Value = Me.ComboBox4.Value
ws.Cells(iRow + 2, 8).Value = Me.ComboBox3.Value
ws.Cells(iRow + 2, 13).Value = Me.ComboBox5.Value

End If

 

تحياتي

 

جزاك الله خيرا احمد عبدالناصر علي اهتمامك وعلي الفكرة الجيدة 

لكن للاسف مامشي الحال لاني اريد انه في حالة ان الكمومبو بوكس 7 فارغ يجعل قيمة التكست بوكس 5 و 6 قيمتهم صفر حتي لايؤثر علي المعادلة التي تحسب اجمالى قيمة الفاتورة واذا كان هانك بالكومبو بوكس 7 قيمة بنفذ  االموجود بالكود السابق

 

وكذلك الحال بالنسبة للكومبو بوكس 8  فارغ يجعل قيمة التكست بوكس 7 و8 قيمتهم صفر حتي لايؤثر علي المعادلة التي تحسب اجمالى قيمة الفاتورة واذا كان هانك بالكومبو بوكس 8 قيمة بنفذ  االموجود بالكود السابق

 

وشكرا لتعاونك معى

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

جرب هذا على حسب ما فهمت

 

If Not Me.ComboBox7.Value = "" Then

ws.Cells(iRow + 1, 2).Value = Me.TextBox4.Value
ws.Cells(iRow + 1, 3).Value = DateSerial(Year(Me.TextBox1.Value), Month(Me.TextBox1.Value), Day(Me.TextBox1.Value))
ws.Cells(iRow + 1, 4).Value = Me.ComboBox4.Value
ws.Cells(iRow + 1, 8).Value = Me.ComboBox3.Value
ws.Cells(iRow + 1, 13).Value = Me.ComboBox5.Value
Else
TextBox5.Text = 0
TextBox6.Text = 0

End If
If Not Me.ComboBox8.Value = "" Then

ws.Cells(iRow + 2, 2).Value = Me.TextBox4.Value
ws.Cells(iRow + 2, 3).Value = DateSerial(Year(Me.TextBox1.Value), Month(Me.TextBox1.Value), Day(Me.TextBox1.Value))
ws.Cells(iRow + 2, 4).Value = Me.ComboBox4.Value
ws.Cells(iRow + 2, 8).Value = Me.ComboBox3.Value
ws.Cells(iRow + 2, 13).Value = Me.ComboBox5.Value
Else
TextBox7.Text = 0
TextBox8.Text = 0

End If

 

تحياتي

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

اخى العزيز جرب وضع هذا الكود اسفل تعريفك للمغيرات  اى اول امر سينفذة قبل اى كود اخر كما  واخبرنى بالنتيجه 


If ComboBox7.Value = "" Or ComboBox8 = "" Then Exit Sub

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

Private Sub CommandButton1_Click()



Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("ÝæÇÊíÑ ÇáÈíÚ")

ضع هذا السطر من الكود فى هذا الموضع وان شاء الله يؤدى ما تريد 
if ComboBox7.Value = "" Or ComboBox8 = "" Then Exit Sub

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

الاخ / احمد عبدالناصر

طبعا فهمت صح والتعديل اكثر من رائع وجزاك الله الف خير

بس باطلب منك المساعدة في رسالة الخطأ هذ والموجوده في الشيت اللي بالبوست ده http://www.officena.net/ib/index.php?showtopic=45340

 

 

 

الاخ / HIMASS 

شكرا جزيلا علي اهتمامك وفكرتك ايضا جيده وتؤدي نفس النتيجه

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

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