How can i sort in seperate Sheet

Gaurav Walia

New Member
Joined
Aug 9, 2003
Messages
28
Delhi 5
Bangkok 15
Cairo 6
London 11
Singapore2

What I want is this should order in a separate excel sheet in the order listed below

Bangkok 15
London 11
Cairo 6
Delhi 5
Singapore2
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Gaurav Walia

New Member
Joined
Aug 9, 2003
Messages
28
Sorry there might be duplicates also but i need only one result for delhi and bangkok sorted in order but the value will be same for delhi etc even if duplicates are there.
 
Upvote 0

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,900
Office Version
  1. 365
Platform
  1. Windows
Assuming data below is in sheet1 and you want it placed and then sorted in sheet2, try:
Code:
Sub MoveAndSort()
Dim i As Long
With Sheets("Sheet1")
    i = .Range("A" & Rows.Count).End(xlUp).Row
    .Range("A1:B" & i).Copy
End With
With Sheets("Sheet2").Range("A1")
    .PasteSpecial Paste:=xlValues
    .CurrentRegion.Sort Key1:=Range("B1"), Order1:=xlDescending
End With
End Sub
 
Upvote 0

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,900
Office Version
  1. 365
Platform
  1. Windows
My macro again but to remove duplicates and then sort:
Code:
Sub MoveAndSort()
Dim i As Long
With Sheets("Sheet1")
    i = .Range("A" & Rows.Count).End(xlUp).Row
    With .Range("A1:B" & i)
        .AdvancedFilter Action:=xlFilterInPlace, unique:=True
        .Copy
    End With
End With
With Sheets("Sheet2")
    .Range("A1").PasteSpecial Paste:=xlValues
    .Range("A1").CurrentRegion.Sort Key1:=Range("B1"), Order1:=xlDescending
End With
Sheets("Sheet1").ShowAllData
End Sub
 
Upvote 0

Forum statistics

Threads
1,191,177
Messages
5,985,132
Members
439,941
Latest member
robertv13

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
Top