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

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

  • أفضل إجابة
قام بنشر
Sub Test()
    Dim a, ws As Worksheet, rng As Range, m As Long
    Application.ScreenUpdating = False
        Set ws = ThisWorkbook.Worksheets(1)
        m = ws.Cells(Rows.Count, "B").End(xlUp).Row
        Set rng = ws.Range("B3:B" & m)
        rng.Offset(, 1).Formula = "=kh_Names($B3,1,2)"
        rng.Offset(, 2).Formula = "=kh_Names($B3,1,2,3)"
        rng.Offset(, 3).Formula = "=kh_Names($B3,1,2,3,4)"
        rng.Offset(, 4).Formula = "=IF(COUNTIF($C$3:$C$" & m & ",C3)>1,COUNTIF($C$3:$C$" & m & ",C3),C3)"
        rng.Offset(, 5).Formula = "=IFERROR(IF(VALUE(F3)>1,IF(COUNTIF($D$3:$D$" & m & ",D3)>1,COUNTIF($D$3:$D$" & m & ",D3),D3),""""),"""")"
        rng.Offset(, 6).Formula = "=IFERROR(IF(VALUE(G3)>1,IF(COUNTIF($E$3:$E$" & m & ",E3)>1,COUNTIF($E$3:$E$" & m & ",E3),E3),""""),"""")"
        With rng.Offset(, 7)
            .Formula = "=CONCATENATE(IF(AND(ISTEXT(F3),F3<>""""),F3,""""),IF(AND(ISTEXT(G3),G3<>""""),G3,""""),IF(AND(ISTEXT(H3),H3<>""""),H3,""""))"
            a = .Value
            rng.Offset(, 1).Value = a
        End With
        ws.Columns("D:I").ClearContents
    Application.ScreenUpdating = True
End Sub

 

  • Like 3
قام بنشر

To implement
With your workbook active press Alt+F11 to bring up the vba window
In the Visual Basic window use the menu to Insert|Module
Copy and Paste the code below into the main right hand pane that opens at step 2
Close the Visual Basic window
Press Alt+F8 to bring up the Macro dialog
Select the macro & click 'Run'

Your workbook will need to be saved as a macro-enabled workbook (*.xlsm)
 

استخراج اسماء من اسم كامل.xlsm

  • Thanks 1
قام بنشر

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

MM.xlsm

قام بنشر

It's better not to put a lot of codes in worksheet module such as worksheet_change. Just input your data and finally click on a button to do all the task for you in one shot

  • Like 2

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