how to set a list in ascending order

jayanthimurali

Board Regular
Joined
Oct 15, 2010
Messages
238
Hi

I enter a list of names the way they come during a month, the name may be repeted, but at the end of the month i copy in another file where in i sort manually in ascending order. can somebody help me in using macros where in if copy to some new file it should atomatically sort in ascending order.

Thanks in advance
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Code:
Sub SortAutomatically()

    Dim shTemp As Worksheet, rng As Range
    
    Set rng = Range("A1:A100")
    Set shTemp = Sheets.Add
    rng.Copy shTemp.Range("A1")
    
    With shTemp.Range("A1").CurrentRegion
        .Sort Key1:=shTemp.Range("A1"), Order1:=xlAscending
        .Copy rng.Cells(1, 1)
    End With
    
    shTemp.Delete

End Sub
 
Upvote 0
Thank u very much.

i have one more question ok ihave copied in a new excel, can i copy this in an old file where in i have the data for previous months. for example, cell A to C i have for jan, D to F i have for FEB can i copy this in the same file for the next month.
 
Upvote 0
can some one help with the above question and also one more query

I have two sheets. in first page i paste month wise. on the second page after completion of the month i move the same data to the second page for example if i have jan in row A, feb in row B. so on....
is there a way when the month ends it should automatically move to the next sheet and the next row.

thanks in advance.
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,903
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top