اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

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

قام بنشر (معدل)
Public Property Get CrWS() As Worksheet
    Set CrWS = Sheets("ورقة1")
End Property

Private Sub UserForm_Initialize()
    Dim Tbl As Object, c As Range, temp As Variant, lastRow As Long
    Set Tbl = CreateObject("Scripting.Dictionary")
    lastRow = CrWS.Cells(CrWS.Rows.Count, "B").End(xlUp).Row
    
    If lastRow > 1 Then
        For Each c In CrWS.Range("B2:B" & lastRow)
            If c.Value <> "" Then Tbl.Item(c.Value) = c.Value
        Next c
    End If
    
    If Tbl.Count > 0 Then
        temp = Tbl.items
        Me.ComboBox1.List = temp
    End If
End Sub

Private Sub CommandButton1_Click()
    Dim lastRow As Long, ky As String
    If Me.ComboBox1.Value <> "" Then
    ky = "=*" & Me.ComboBox1.Value & "*"
    lastRow = CrWS.Cells(CrWS.Rows.Count, "B").End(xlUp).Row

    If lastRow < 2 Then Exit Sub

    Application.ScreenUpdating = False
    With CrWS.Range("B1:B" & lastRow)
        .AutoFilter Field:=1, Criteria1:=ky
    End With

    On Error Resume Next
    CrWS.Range("A2:C" & lastRow).SpecialCells(xlCellTypeVisible).EntireRow.Delete
    On Error GoTo 0
    CrWS.AutoFilterMode = False
    Application.ScreenUpdating = True
    Unload Me
    End If
End Sub

السلام عليكم ممكن تعديل على الكود ليعمل على ملف اخر مفتوح وليكن اسمه كلية واسم الشيت القسم مع جزيل الشكر

كلية.xlsb ملف الاصلي.xlsb

تم تعديل بواسطه ابو طيبه
اضافة مرفقات
قام بنشر (معدل)

مشكور على ردك استاذ انا اقصد ان يتم العمل على ملف الكليه دون اضافة الكود في الملف اي ان يتم التنفيذ الكود من كود الملف الاصلي ( يعني في حال عندي ملفات اخرى اقوم فقط بتغيير اسم الملف في كود الملف الاصلي واسم الشيت ليتم تنفيذه على الملف المطلوب)ويكون الملفان مفتوحان بنفس الوقت تحياتي لك 

تم تعديل بواسطه ابو مارفن

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