+ Reply to Thread
Results 1 to 17 of 17

Please I need a macro to delete duplicate cells in a several selected cells in Excel?

  1. #1
    Registered User
    Join Date
    02-14-2014
    Location
    Qatar
    MS-Off Ver
    Excel 2003
    Posts
    8

    Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    Can you please help me
    I have lots of records in different row
    I need to delete the duplicate cells form them
    ie
    R1 : 1,2,3,1,3,5
    R2: 2,1,6,2,4,5
    it is requiered to be like this
    R1: 1,-,3,-,5
    R2: 2,-,6,-,4
    where - is emply cell

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    attach please a sample file with data and desired result
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    Hi, amkoloui,

    you would need to explain if teh guess fo first going through Column A is correct as I would have the result to be different from what you show up (first work the row and then the column leading to a different result of figures at different places).

    Generally spoken itīs a loop to go through the cells and use WorksheetFnction.CountIf with the range passed and clearing the contents if the result is greater 1 but we would need to know how to proceed (if itīs going through the rows first a For Each...Next could be used, if itīs the Columns first 2 loops would be needed).

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    02-14-2014
    Location
    Qatar
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    Quote Originally Posted by patel45 View Post
    attach please a sample file with data and desired result
    it is uploaded
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-14-2014
    Location
    Qatar
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    I Had some search in the net and found some macro useful
    To arrange the date in one column
    but it dose not arrange the list or delete the duplicate
    how i can modify this to arrange the result and delete the duplicate



    http://www.extendoffice.com/document...column.html#a2

    Please Login or Register  to view this content.
    Last edited by amkoloui; 02-15-2014 at 12:02 PM.

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    Hi, amkoloui,

    you would need to add code-tags around your procedure according to Forum Rule #3 before anybody would be able to answer to this thread.

    Ciao,
    Holger

  7. #7
    Registered User
    Join Date
    02-14-2014
    Location
    Qatar
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    Hi, Holger
    Is it done ?
    Last edited by amkoloui; 02-15-2014 at 11:57 AM.

  8. #8
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    Quote Originally Posted by patel45 View Post
    attach please a sample file with data and desired result
    where is desired result ?

  9. #9
    Registered User
    Join Date
    02-14-2014
    Location
    Qatar
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    i need to arrage these data in one clumn and remove the dublicated

  10. #10
    Registered User
    Join Date
    02-14-2014
    Location
    Qatar
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    This is the data sample with the desired result
    Regards,
    Ahmed EL Koloui Data Sample desired result.xlsmData Sample desired result.xlsm

  11. #11
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    try this code
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    02-14-2014
    Location
    Qatar
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    HI , Patel ,
    Unfortunately this code do not work correctly
    It leaves some duplicate data



    The code i copied is copying all the data in a selecting range
    then
    selecting the target data and past it
    but it do not remove the duplicate or arranging the records

  13. #13
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    Hi Amkoloui,
    Try the attached.
    Attached Files Attached Files

  14. #14
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    or
    Please Login or Register  to view this content.
    edited
    or
    Please Login or Register  to view this content.
    Last edited by nilem; 02-15-2014 at 01:47 PM. Reason: add option

  15. #15
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    Hi Niem,
    I was doing system collection code to avoid sorting the data, but you beat me to the line.

  16. #16
    Registered User
    Join Date
    02-14-2014
    Location
    Qatar
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    Thank You Niem,
    The Sub ertert2 works perfectly
    Thank You

  17. #17
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Please I need a macro to delete duplicate cells in a several selected cells in Excel?

    Hi Ahmed,
    You are welcome!
    The Sub Updatemine from AB works well too

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Macro: Remove Duplicate before Pasting Text (on selected cells)
    By rampal in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-23-2013, 10:31 AM
  2. Macro to Delete All Checkboxes in Selected Cells
    By clintonwarren in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-22-2012, 06:03 PM
  3. Replies: 7
    Last Post: 10-06-2011, 07:38 PM
  4. Replies: 2
    Last Post: 08-28-2011, 02:39 AM
  5. Replies: 2
    Last Post: 08-24-2011, 05:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1