VBA code to remove duplicate numbers and rearrange data

  • Carim

    Changed the title of the thread from “Please help me with VBA code to remove duplicate numbers and rearrange data” to “VBA code to remove duplicate numbers and rearrange data”.
  • Try the attached, click the button on Sheet1.


    Code assigned to the button:

  • HGVIET


    Would you mind using Code Tags ... ONLY for Code ...

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Not sure what you mean by "run it again to get results", clicking the button a second time changes nothing.


    It might help if you included a sheet which shows the result you expect.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Not sure why you got 2 entries for Day 4 Hour 22, I did not!


    Try changing Line 44 of the code

    Code
    While iii < UBound(x)

    To

    Code
    While iii <= UBound(x)

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • To delete duplicate rows and rearrange the data in the way you described, you can use the following VBA code:

    To use this code, copy and paste it into the VBA editor and then run it by pressing the "Run" button or by pressing F5. Make sure to change the sheet name in line 6 to the name of the sheet where your data is located.

    I hope this helps! Let me know if you have any questions.



Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!