• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

sorting and duplication query

mahaveer

Member
i want to make my "column A" sort A to Z... and remove duplicates too

suppose column A has 25 row fillup now then sorting and removing duplicates required 25 row only when 26th row fill up then 1-26 row sorting and remove duplicated required...so on...

is it possible from any formula or any vba code?
 
Hi,


Insert a Module and paste the below code and try .


Sub newsort()

Dim k As String

k = ActiveSheet.Name

Range("A1").Select

Range(Selection, Selection.End(xlDown)).RemoveDuplicates Columns:=1, Header:=xlYes

ActiveWorkbook.Worksheets(k).Sort.SortFields.Add Key:=Range(Selection, Selection.End(xlDown)), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal

With ActiveWorkbook.Worksheets(k).Sort

.SetRange Range(Selection, Selection.End(xlDown))

.Header = xlYes

.MatchCase = False

.Orientation = xlTopToBottom

.SortMethod = xlPinYin

.Apply

End With

Range("A1").Select

End Sub


Thanks,

Suresh Kumar S
 
thanks suresh

its really perfect but i want some thing change in this code if u can provide me

actually i want to remove duplicates from column A along with corresponding cell in column b too

and i want to make sorting of column A with column b too....

if is it possible that code runs only for fillup data not blank one.....so that it dont take more time.....thanks again dear
 
Hi Mahaveer,


Can you please upload the same file? (Original Data as well as Final Output data in different worksheets)


Thanks,

Suresh Kumar S
 
@Suresh Kumar

Hi!

Embedding your posted code within bacticks (`) will keep indentation, just as displayed below the Reply area down here.

Regards!
 
Back
Top