الصفتى قام بنشر سبتمبر 25, 2021 مشاركة قام بنشر سبتمبر 25, 2021 الساده الافاضل هل يمكن تحويل كود البحث المرفق فى النموذج و احضار البيانات من اعمدة غير منتظمة وفقا لتكست بوكس1 الى احضار نفس البيانات و لكن وفقا لكومبوبوكس و تكست بوكس 1 معا Public Sub CMDSEARCH_Click() ListBox1.CLEAR ListBox1.ColumnCount = 7 ListBox1.ColumnWidths = "60 pt;150 pt;80 pt;150 pt;100 pt;70 pt;100 pt" ListBox1.ColumnHeads = 0 Dim ws As Worksheet, i As Long, i2 As Long Set ws = Sheets("ليدجر") Dim lastrow As Long lastrow = ws.Cells(Rows.Count, "b").End(xlUp).Row For i = 1 To lastrow If TextBox1 <> "" And InStr(ws.Cells(i, 3), TextBox1) <> 0 Then ListBox1.AddItem ListBox1.List(i2, 0) = ws.Cells(i, 1) ListBox1.List(i2, 1) = ws.Cells(i, 3) ListBox1.List(i2, 2) = ws.Cells(i, 4) ListBox1.List(i2, 3) = ws.Cells(i, 16) ListBox1.List(i2, 4) = ws.Cells(i, 17) ListBox1.List(i2, 5) = ws.Cells(i, 18) ListBox1.List(i2, 6) = ws.Cells(i, 10) i2 = i2 + 1 End If Next i End Sub تجربة (1).xlsb رابط هذا التعليق شارك More sharing options...
أفضل إجابة lionheart قام بنشر سبتمبر 26, 2021 أفضل إجابة مشاركة قام بنشر سبتمبر 26, 2021 Public Sub CMDSEARCH_Click() Dim x, ws As Worksheet, i As Long, j As Long, lastRow As Long With Me.ListBox1 .Clear .ColumnCount = 7 .ColumnWidths = "60 pt;150 pt;80 pt;150 pt;100 pt;70 pt;100 pt" .ColumnHeads = 0 Set ws = Sheets("Ledger") x = Application.Match(ComboBox1.Value, ws.Rows(1), 0) If Not IsError(x) Then lastRow = ws.Cells(Rows.Count, "B").End(xlUp).Row For i = 1 To lastRow If TextBox1 <> "" And InStr(ws.Cells(i, x), TextBox1) <> 0 Then .AddItem .List(j, 0) = ws.Cells(i, 1) .List(j, 1) = ws.Cells(i, 3) .List(j, 2) = ws.Cells(i, 4) .List(j, 3) = ws.Cells(i, 16) .List(j, 4) = ws.Cells(i, 17) .List(j, 5) = ws.Cells(i, 18) .List(j, 6) = ws.Cells(i, 10) j = j + 1 End If Next i End If End With End Sub 4 1 رابط هذا التعليق شارك More sharing options...
الصفتى قام بنشر سبتمبر 26, 2021 الكاتب مشاركة قام بنشر سبتمبر 26, 2021 بارك الله فيك و جعلك عونا للسائلين ، جزاك الله خيرا 1 رابط هذا التعليق شارك More sharing options...
الصفتى قام بنشر سبتمبر 26, 2021 الكاتب مشاركة قام بنشر سبتمبر 26, 2021 استاذى الفاضل بفرض عمود 6 و 7 بالليست بوكس تحتوى على ارقام هل يوجد كود يضيف عمود جديد بالليست بوكس فرضا عمود 8 و بقوم بطرح عمود 6 - عمود 7 و شاكرا لك سعة صدرك رابط هذا التعليق شارك More sharing options...
lionheart قام بنشر سبتمبر 26, 2021 مشاركة قام بنشر سبتمبر 26, 2021 Better to insert a column in the worksheet and populate the listbox from the column on the worksheet. Don't complicate your file 1 رابط هذا التعليق شارك More sharing options...
الصفتى قام بنشر سبتمبر 26, 2021 الكاتب مشاركة قام بنشر سبتمبر 26, 2021 شكرا لكم لقد وجدت الحل لاضافة عمود فى الليست للطرح بين عمودين فى الليست بوكس و الحل للافادة هو اقتباس .List(j, 9) = Val(.List(j, 7)) - Val(.List(j, 8)) 1 رابط هذا التعليق شارك More sharing options...
الصفتى قام بنشر أكتوبر 12, 2021 الكاتب مشاركة قام بنشر أكتوبر 12, 2021 استاذى الفاضل هل ممكن تعديل الكود بحيث يظهر كل الاعمدة الموجوده فى الليدجر من a : s اقتباس في ٢٦/٩/٢٠٢١ at 07:29, lionheart said: Public Sub CMDSEARCH_Click() Dim x, ws As Worksheet, i As Long, j As Long, lastRow As Long With Me.ListBox1 .Clear .ColumnCount = 7 .ColumnWidths = "60 pt;150 pt;80 pt;150 pt;100 pt;70 pt;100 pt" .ColumnHeads = 0 Set ws = Sheets("Ledger") x = Application.Match(ComboBox1.Value, ws.Rows(1), 0) If Not IsError(x) Then lastRow = ws.Cells(Rows.Count, "B").End(xlUp).Row For i = 1 To lastRow If TextBox1 <> "" And InStr(ws.Cells(i, x), TextBox1) <> 0 Then .AddItem .List(j, 0) = ws.Cells(i, 1) .List(j, 1) = ws.Cells(i, 3) .List(j, 2) = ws.Cells(i, 4) .List(j, 3) = ws.Cells(i, 16) .List(j, 4) = ws.Cells(i, 17) .List(j, 5) = ws.Cells(i, 18) .List(j, 6) = ws.Cells(i, 10) j = j + 1 End If Next i End If End With End Sub رابط هذا التعليق شارك More sharing options...
faisal77 قام بنشر نوفمبر 16, 2021 مشاركة قام بنشر نوفمبر 16, 2021 السلام عليكم اخواني إذا في أحد أحد ممكن يساعدني في تعديل الملف أكون شاكر له جداً عندي ملف فيه 12 عمود وواحد ليست بوكس وواحد كمبوبوكس لإختيار الحقل المطلوب البحث من خلال المطلوب التعديل على شيئين في الملف فقط مع الحفاظ على باقي خصائص الملف وهم : 1. كيف أخلي الليست بوكس يستوعب عدد 17 عمود بدلاً من 12 عمود 2. كيف أخلي مربع النص الخاص بالتسلسل يأخذ ترقيم تلقائي في كل عملية ادخال أذا في أحد أحد ممكن يساعدني أكون شاكر له جداً رابط هذا التعليق شارك More sharing options...
حسونة حسين قام بنشر نوفمبر 16, 2021 مشاركة قام بنشر نوفمبر 16, 2021 اخى faisal77 قم بطرح موضوع جديد خاص بك وارفق ملف مشروحا به ما تريد وشكل النتائج المتوقعه للبيانات حتى يتسنى للاخوة المساعده رابط هذا التعليق شارك 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.