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

كود ترحيل


إذهب إلى أفضل إجابة Solved by محي الدين ابو البشر,

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

Sub test()
Dim a, x, w
Dim i&, ii&
Dim r As Range
a = Sheets("sheet1").Cells(1).CurrentRegion
With CreateObject("scripting.dictionary")
        For i = 2 To UBound(a)
            For ii = 2 To UBound(a, 2): x = IIf(x = "", a(i, ii), x & "|" & a(i, ii)): Next
            If Not .exists(a(i, 1)) Then
                    .Add a(i, 1), x: x = ""
             Else
            .Item(a(i, 1)) = .Item(a(i, 1)) & "#" & x: x = ""
            End If
        Next
        Application.ScreenUpdating = False
        Application.DisplayAlerts = False
      For Each x In .keys
       Set r = Sheets("sheet2").Cells.Find(x, , , 1).Cells
        x = Split(.Item(x), "#")
        With Sheets("sheet2")
            With r.Offset(, 1).Resize(UBound(x))
                .Value = Application.Transpose(x)
             .TextToColumns r.Offset(, 1), 1, Other:=True, OtherChar:="|", FieldInfo:=Array(Array(7, 1))
       End With: End With
        Next
End With
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

 

Book1.xlsm

رابط هذا التعليق
شارك

Armia Nabil   عنوان مخالف جداً لابد من تعديل وتغيير عنوان المشاركة ليعبر عن طلبك وحتى يسهل البحث بالمنتدى مستقبلاً لمن له مث طلبك !!!

رابط هذا التعليق
شارك

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