Ahmed Saad 2017 قام بنشر نوفمبر 13, 2022 مشاركة قام بنشر نوفمبر 13, 2022 السلام عليكم وبها نبدأ اي موضوع برجاء التعديل علي كود ترحيل بيانات من لست بوكس الي شيت اكسيل حيث اريد انه عندما لا يوجد كمية في Text box 3 ان لا يقوم بالترحيل وان تظهر رسالة بادخال الكمية حيث تم التعديل وتظهر الرسالة ولكن يتم تنفيذ الامر برجاء الافادة الكود Private Sub ListBox1_Click() Application.ScreenUpdating = False Application.EnableEvents = False Application.Calculation = xlCalculationManual LR = Sheet1.Range("C" & Rows.Count).End(xlUp).Row + 1 For YYY = 0 To ListBox1.ListCount If ListBox1.Selected(YYY) = True Then TextBox3.Enabled = True Range("C" & LR).Value = ListBox1.List(YYY, 0) Range("B" & LR).Value = ListBox1.List(YYY, 1) Range("D" & LR).Value = ListBox1.List(YYY, 2) Range("E" & LR).Value = ListBox1.List(YYY, 3) Range("A" & LR).Value = ListBox1.List(YYY, 4) Range("F" & LR).Value = TextBox3.Value If TextBox3 <> "0" Then MsgBox " please insert a count ": Exit Sub Range("G" & LR).Value = Cells(9, 7).Formula = "=(E9 * F9)" ListBox1.Visible = True TextBox1 = "" TextBox2 = "" TextBox3 = "" 'Cells(9, 7).Formula = "=(E9 * F9)" 'Range("G9:G200").FillDown 'Exit Sub End If Next YYY Application.ScreenUpdating = True Application.EnableEvents = True Application.Calculation = xlCalculationAutomatic end sub تم وضع الكود بطريقه صحيحه لتسهل قراءته رابط هذا التعليق شارك More sharing options...
ضاحي الغريب قام بنشر نوفمبر 14, 2022 مشاركة قام بنشر نوفمبر 14, 2022 استبدل السطر التالي Range("F" & LR).Value = Me.TextBox3.Value بالشرط If Me.TextBox3 <> "" Then Range("F" & LR).Value = Me.TextBox3.Value Else MsgBox "Please enter the quantity" Me.TextBox3.SetFocus End If End Sub او If Me.TextBox3 = "" Then MsgBox "Please enter the quantity": Me.TextBox3.SetFocus: Exit Sub Range("F" & LR).Value = Me.TextBox3.Value 2 رابط هذا التعليق شارك More sharing options...
Ahmed Saad 2017 قام بنشر نوفمبر 15, 2022 الكاتب مشاركة قام بنشر نوفمبر 15, 2022 استاذ ضاحي بشكرك جزيلا علي المساعدة انا بعت الشيت لحضرتك و بدلت السطر بس الرسالة بتظهر و لما بكتب العدد في التيكست بوكس 3 ودوس علي الصنف تاني للترحيل في الفاتورة مش بيرحل وياريت حضرتك تقولي ليه السطر الخاص بكود ضرب عمود الكمية في السعر مش بيسمع وشكرا جزيلا وهذه هى المعادلة CONCATENATE(D7," - ",D6," - ",TEXT(D5,"dd-mm-yyyy")) بعتذر لحضرتك تم الارسال test (2).xlsm رابط هذا التعليق شارك More sharing options...
ضاحي الغريب قام بنشر نوفمبر 15, 2022 مشاركة قام بنشر نوفمبر 15, 2022 حياك الله الشكر لله 1 رابط هذا التعليق شارك More sharing options...
Ahmed Saad 2017 قام بنشر نوفمبر 15, 2022 الكاتب مشاركة قام بنشر نوفمبر 15, 2022 تم تعديل الملف وارساله مره اخري اشكرك جزيلا test (2).xlsm رابط هذا التعليق شارك More sharing options...
ضاحي الغريب قام بنشر نوفمبر 15, 2022 مشاركة قام بنشر نوفمبر 15, 2022 الكود بعد التعديل جرب وقولي النتيجة Private Sub ListBox1_Click() Application.ScreenUpdating = False Application.EnableEvents = False Application.Calculation = xlCalculationManual LR = Sheet1.Range("C" & Rows.Count).End(xlUp).Row + 1 For YYY = 0 To ListBox1.ListCount If ListBox1.Selected(YYY) = True Then If Me.TextBox3 = "" Then MsgBox "Please enter the quantity": Me.TextBox3.SetFocus: Exit Sub Range("F" & LR).Value = Me.TextBox3.Value Range("D" & LR).Value = ListBox1.List(YYY, 0) Range("B" & LR).Value = ListBox1.List(YYY, 1) Range("C" & LR).Value = ListBox1.List(YYY, 2) Range("E" & LR).Value = ListBox1.List(YYY, 3) Range("A" & LR).Value = ListBox1.List(YYY, 4) Range("G" & LR).Value = Format(ListBox1.List(YYY, 3) * Me.TextBox3.Value, "0.00") ' Range("G" & LR).Value = Cells(9, 7).Formula = "=(E9 * F9)" ' Range("G" & LR).Value = "=(E9 * F9)" 'ListBox1.Visible = True 'ListBox2.Visible = True 'ListBox3.Visible = True TextBox1 = "" TextBox2 = "" TextBox3 = "" End If Next YYY Application.ScreenUpdating = True Application.EnableEvents = True Application.Calculation = xlCalculationAutomatic End Sub رابط هذا التعليق شارك More sharing options...
ضاحي الغريب قام بنشر نوفمبر 15, 2022 مشاركة قام بنشر نوفمبر 15, 2022 الكود بعد تعديل شرط الكمية Private Sub ListBox1_Click() Application.ScreenUpdating = False Application.EnableEvents = False Application.Calculation = xlCalculationManual LR = Sheet1.Range("C" & Rows.Count).End(xlUp).Row + 1 For YYY = 0 To ListBox1.ListCount If ListBox1.Selected(YYY) = True Then If Me.TextBox3 = "" Then MsgBox "Please enter the quantity": Me.TextBox3.SetFocus: Exit Sub Range("F" & LR).Value = Me.TextBox3.Value Range("D" & LR).Value = ListBox1.List(YYY, 0) Range("B" & LR).Value = ListBox1.List(YYY, 1) Range("C" & LR).Value = ListBox1.List(YYY, 2) Range("E" & LR).Value = ListBox1.List(YYY, 3) Range("A" & LR).Value = ListBox1.List(YYY, 4) Range("G" & LR).Value = Format(ListBox1.List(YYY, 3) * Me.TextBox3.Value, "0.00") 'ListBox1.Visible = True 'ListBox2.Visible = True 'ListBox3.Visible = True TextBox1 = "" TextBox2 = "" TextBox3 = "" End If Next YYY Application.ScreenUpdating = True Application.EnableEvents = True Application.Calculation = xlCalculationAutomatic End Sub 1 رابط هذا التعليق شارك More sharing options...
Ahmed Saad 2017 قام بنشر نوفمبر 15, 2022 الكاتب مشاركة قام بنشر نوفمبر 15, 2022 جربت الكود الجديد (الكود بعد تعديل شرط الكمية) الكود شغال تمام بس لما بيكون مفيش كمية بيطلعلي الرسالة و لما بحط الكمية وادوس علي نفس الصنف مش بيرحل البيانات لازم اعيد كتابة الصنف تاني او اختار صنف غيره محتاج اول ما اكتب الكمية و ارجع اعمل سلكت علي الصنف يرحل تلقائي زي الكود رابط هذا التعليق شارك More sharing options...
أفضل إجابة ضاحي الغريب قام بنشر نوفمبر 15, 2022 أفضل إجابة مشاركة قام بنشر نوفمبر 15, 2022 ضيف الكود ده علي الفورم Private Sub TextBox3_AfterUpdate() If Me.TextBox1 = "" Then Exit Sub If ListBox1.Value <> 0 Then ListBox1_Click End If End Sub خده نسخ والصقه عندك مجرد هاتدخل الكمية وترجع للصنف هاشتغل جرب وقولي رابط هذا التعليق شارك More sharing options...
Ahmed Saad 2017 قام بنشر نوفمبر 15, 2022 الكاتب مشاركة قام بنشر نوفمبر 15, 2022 تمام و بشكرك حضرتك جزيل الشكر علي مجهودك جزاك الله خيرا بشكرك جزيلا لمساعدة حضرتك ربنا يباركلك رابط هذا التعليق شارك More sharing options...
ضاحي الغريب قام بنشر نوفمبر 16, 2022 مشاركة قام بنشر نوفمبر 16, 2022 الشكر لله ربنا يوفقك رابط هذا التعليق شارك More sharing options...
الردود الموصى بها
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.