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

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

قام بنشر (معدل)
Sub ragab()
Application.ScreenUpdating = False
T = Range("D12").Value: TT = Range("E12").Value
R = ActiveWorkbook.Name
For i = 1 To 2
    On Error Resume Next
    x = ActiveWorkbook.Path & "\" & i & ".xls"
    Workbooks.Open Filename:=x, Password:=4444
        
        For Each cl In Workbooks(i).Sheets("ÊÝÕíáí ÇáÊÔÛíáÇÊ").Range("C4:C600")
        If cl = T And cl.Offset(0, 3) = TT Then
        Workbooks®.Sheets("ÇáÈÍË Úä ÇáÊÔÛíáÇÊ").Range("D15") = cl.Offset(0, -2)
        Workbooks®.Sheets("ÇáÈÍË Úä ÇáÊÔÛíáÇÊ").Range("D16") = cl.Offset(0, -1)
        End If
        Next
        
        For Each cl In Workbooks(i).Sheets("ÊÝÕíáí ÇáÊÔÛíáÇÊ").Range("P4:P600")
        If cl = T And cl.Offset(0, 3) = TT Then
        Workbooks®.Sheets("ÇáÈÍË Úä ÇáÊÔÛíáÇÊ").Range("E15") = cl.Offset(0, -2)
        Workbooks®.Sheets("ÇáÈÍË Úä ÇáÊÔÛíáÇÊ").Range("E16") = cl.Offset(0, -1)
        End If
        Next
        
        For Each cl In Workbooks(i).Sheets("ÊÝÕíáí ÇáÊÔÛíáÇÊ").Range("ae4:ae600")
        xx = cl.Offset(0, 3).Value
        If cl = T And cl.Offset(0, 3) = TT Then
        Workbooks®.Sheets("ÇáÈÍË Úä ÇáÊÔÛíáÇÊ").Range("F15") = cl.Offset(0, -2)
        Workbooks®.Sheets("ÇáÈÍË Úä ÇáÊÔÛíáÇÊ").Range("F16") = cl.Offset(0, -1)
        End If
        Next
        
        For Each cl In Workbooks(i).Sheets("ÊÝÕíáí ÇáÊÔÛíáÇÊ").Range("AV4:AV600")
        If cl = T And cl.Offset(0, 3) = TT Then
        Workbooks®.Sheets("ÇáÈÍË Úä ÇáÊÔÛíáÇÊ").Range("G15") = cl.Offset(0, -2)
        Workbooks®.Sheets("ÇáÈÍË Úä ÇáÊÔÛíáÇÊ").Range("G16") = cl.Offset(0, -1)
        End If
        Next
        
        For Each cl In Workbooks(i).Sheets("ÊÝÕíáí ÇáÊÔÛíáÇÊ").Range("BK4:BK600")
        If cl = T And cl.Offset(0, 3) = TT Then
        Workbooks®.Sheets("ÇáÈÍË Úä ÇáÊÔÛíáÇÊ").Range("H15") = cl.Offset(0, -2)
        Workbooks®.Sheets("ÇáÈÍË Úä ÇáÊÔÛíáÇÊ").Range("H16") = cl.Offset(0, -1)
        End If
        Next
        
        For Each cl In Workbooks(i).Sheets("ÊÝÕíáí ÇáÊÔÛíáÇÊ").Range("BZ4:BZ600")
        If cl = T And cl.Offset(0, 3) = TT Then
        Workbooks®.Sheets("ÇáÈÍË Úä ÇáÊÔÛíáÇÊ").Range("I15") = cl.Offset(0, -2)
        Workbooks®.Sheets("ÇáÈÍË Úä ÇáÊÔÛíáÇÊ").Range("I16") = cl.Offset(0, -1)
        End If
        Next
        
        For Each cl In Workbooks(i).Sheets("ÊÝÕíáí ÇáÊÔÛíáÇÊ").Range("CO4:CO600")
        If cl = T And cl.Offset(0, 3) = TT Then
        Workbooks®.Sheets("ÇáÈÍË Úä ÇáÊÔÛíáÇÊ").Range("J15") = cl.Offset(0, -2)
        Workbooks®.Sheets("ÇáÈÍË Úä ÇáÊÔÛíáÇÊ").Range("J16") = cl.Offset(0, -1)
        End If
        Next
        ActiveWorkbook.Save
        ActiveWindow.Close
Next
Application.ScreenUpdating = True
End Sub
هل من شرح لهذا الكود الرائع ، إخواني الكرام ؟
تم تعديل بواسطه حنفضر
  • 2 years later...

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