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

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

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

السلام عليكم

قم بتفعيل الماكرو

الكود

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$G$2" Then
        Dim wsReport As Worksheet
        Dim wsSearch As Worksheet
        Dim lastRow As Long
        Dim i As Long
        Dim searchDate As Date
        
        Set wsReport = ThisWorkbook.Sheets("REPORT")
        Set wsSearch = ThisWorkbook.Sheets("Search2")
        searchDate = wsSearch.Range("G2").Value
        wsSearch.Range("B4:G1000").ClearContents
        lastRow = wsReport.Cells(wsReport.Rows.Count, "D").End(xlUp).Row
        Dim rowIndex As Long
        rowIndex = 4
        For i = 2 To lastRow
            If wsReport.Cells(i, "D").Value = searchDate Then
                wsSearch.Cells(rowIndex, "B").Value = rowIndex - 3
                wsSearch.Cells(rowIndex, "C").Value = wsReport.Cells(i, "G").Value
                wsSearch.Cells(rowIndex, "F").Value = wsReport.Cells(i, "J").Value
                wsSearch.Cells(rowIndex, "D").Value = wsReport.Cells(i, "I").Value
                wsSearch.Cells(rowIndex, "E").Value = wsReport.Cells(i, "H").Value
                rowIndex = rowIndex + 1
            End If
        Next i
    End If
End Sub

New Microsoft Excel Worksheet (1).xlsb

  • Like 1

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