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

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

قام بنشر

اخواني الكرام 

لدي الكود التالي وهو خاص بالبحث في كل اوراق العمل حاولت اصلاحه ليبحث فقط في صفحات محددة كأن يبحث في الشيت الثالث والرابع والخامس والسادس ويترك البحث في باقي الشيتات ... ارجو المساعدة ... وكتب الله اجوركم

الملف كبير جدا ويتكون من اكثر من 30 شيت ونحن لدينا نت ضعيف جدا في اليمن 

والكود لا يحتاج سوى اسنثناء لبعض الصفحات من البحث

شكرا لك

 

Private Sub TextBox19_Change()
    TextBox1.Value = ""
    TextBox2.Value = ""
    TextBox3.Value = ""
    TextBox4.Value = ""
    TextBox5.Value = ""
    TextBox6.Value = ""
    TextBox7.Value = ""
    TextBox8.Value = ""
    TextBox9.Value = ""
    TextBox10.Value = ""
    TextBox11.Value = ""
    TextBox12.Value = ""
    TextBox13.Value = ""
    TextBox14.Value = ""
    TextBox15.Value = ""
    TextBox16.Value = ""
    TextBox17.Value = ""
    TextBox18.Value = ""
Dim x As Worksheet
         ListBox1.Clear
    k = 0
For Each x In ThisWorkbook.Worksheets
        ss = x.Cells(Rows.Count, 2).End(xlUp).Row
        For Each C In x.Range("c3:c" & ss)
            b = InStr(C, TextBox19)
            If b > 0 Then
                ListBox1.AddItem
                ListBox1.List(k, 0) = x.Cells(C.Row, 1).Value
                ListBox1.List(k, 1) = x.Cells(C.Row, 2).Value
                ListBox1.List(k, 2) = x.Cells(C.Row, 3).Value
                ListBox1.List(k, 3) = x.Cells(C.Row, 4).Value
                ListBox1.List(k, 4) = x.Cells(C.Row, 5).Value
                ListBox1.List(k, 5) = x.Cells(C.Row, 6).Value
                ListBox1.List(k, 6) = x.Cells(C.Row, 7).Value
                ListBox1.List(k, 7) = x.Cells(C.Row, 8).Value
                ListBox1.List(k, 😎 = x.Cells(C.Row, 9).Value
                ListBox1.List(k, 9) = x.Cells(C.Row, 10).Value
                ListBox1.List(k, 10) = x.Cells(C.Row, 11).Value
                ListBox1.List(k, 11) = x.Cells(C.Row, 12).Value
                ListBox1.List(k, 12) = x.Cells(C.Row, 13).Value
                ListBox1.List(k, 13) = x.Cells(C.Row, 14).Value
                ListBox1.List(k, 14) = x.Cells(C.Row, 15).Value
                ListBox1.List(k, 15) = x.Cells(C.Row, 16).Value
                ListBox1.List(k, 16) = x.Cells(C.Row, 17).Value
                ListBox1.List(k, 17) = x.Cells(C.Row, 18).Value
                                k = k + 1
            End If
        Next C
Next x
End Sub

 

  • تمت الإجابة
قام بنشر

يمكنك استعمال هذا الشرط

ضع في المصفوفة shArr اسماء الشيتات التي ترغب البحث فيها

وغير كود for each x الى 

shArr = array("sheet1","sheet2","sheet3")
For Each x In ThisWorkbook.Worksheets
if UBound(Filter(shArr, x.name)) > -1 then
        ss = x.Cells(Rows.Count, 2).End(xlUp).Row
        For Each C In x.Range("c3:c" & ss)
            b = InStr(C, TextBox19)
            If b > 0 Then
                ListBox1.AddItem
                ListBox1.List(k, 0) = x.Cells(C.Row, 1).Value
                ListBox1.List(k, 1) = x.Cells(C.Row, 2).Value
                ListBox1.List(k, 2) = x.Cells(C.Row, 3).Value
                ListBox1.List(k, 3) = x.Cells(C.Row, 4).Value
                ListBox1.List(k, 4) = x.Cells(C.Row, 5).Value
                ListBox1.List(k, 5) = x.Cells(C.Row, 6).Value
                ListBox1.List(k, 6) = x.Cells(C.Row, 7).Value
                ListBox1.List(k, 7) = x.Cells(C.Row, 8).Value
                ListBox1.List(k, 8) = x.Cells(C.Row, 9).Value
                ListBox1.List(k, 9) = x.Cells(C.Row, 10).Value
                ListBox1.List(k, 10) = x.Cells(C.Row, 11).Value
                ListBox1.List(k, 11) = x.Cells(C.Row, 12).Value
                ListBox1.List(k, 12) = x.Cells(C.Row, 13).Value
                ListBox1.List(k, 13) = x.Cells(C.Row, 14).Value
                ListBox1.List(k, 14) = x.Cells(C.Row, 15).Value
                ListBox1.List(k, 15) = x.Cells(C.Row, 16).Value
                ListBox1.List(k, 16) = x.Cells(C.Row, 17).Value
                ListBox1.List(k, 17) = x.Cells(C.Row, 18).Value
                                k = k + 1
            End If
        Next C
end if
Next x

بالتوفيق 

  • Like 1
  • Thanks 1

انشئ حساب جديد او قم بتسجيل دخولك لتتمكن من اضافه تعليق جديد

يجب ان تكون عضوا لدينا لتتمكن من التعليق

انشئ حساب جديد

سجل حسابك الجديد لدينا في الموقع بمنتهي السهوله .

سجل حساب جديد

تسجيل دخول

هل تمتلك حساب بالفعل ؟ سجل دخولك من هنا.

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

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

Important Information