ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   help me on rearrange cells based on its numerical values without repeating any number (https://www.excelbanter.com/excel-worksheet-functions/56631-help-me-rearrange-cells-based-its-numerical-values-without-repeating-any-number.html)

amrezzat

help me on rearrange cells based on its numerical values without repeating any number
 

rearrange cells based on its numerical values without repeating

--------------------------------------------------------------------------------

with this sub

Sub doit()
Range("M1").CurrentRegion.ClearContents
Range("A1").Resize(10, 2).Copy Destination:=Range("M1")
Range("M1").CurrentRegion.Sort Key1:=Range("M1"), Order1:=xlAscending
End Sub


it works
but i dont want to repeat the numbers
i mean
if i input
1 microsoft
2 intel
1 microsoft
the results will be
1
1
2


i dont want that
i want only
1
2
no repeating
how can i do that?
noting that the input my be so long may be 1000 rows
but they are only 50 companies (from 1 to 50)
so the results will be in a max 50 rows

and i want that code to activate(rerun) each time i enter the sheet2

how can i do that ??


--
amrezzat
------------------------------------------------------------------------
amrezzat's Profile: http://www.excelforum.com/member.php...o&userid=28766
View this thread: http://www.excelforum.com/showthread...hreadid=487041



All times are GMT +1. The time now is 03:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com