Sorting column data ascending

Apple08

Active Member
Joined
Nov 1, 2014
Messages
450
Hi everyone

I would like to sort the column F in ascending with row one as header. The spreadsheet have 13 columns up to column M, I have done the code below but it needs debug:

Code:
  Range("A2:M", Range("F" & Rows.Count).End(xlUp)).Sort _
    Key1:=Range("F2"), Order1:=xlAscending

Please could anyone tell me how to amend it? Many thanks.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hello Apple08,

Try the following:-

Code:
Sheet1.Range("A2", Sheet1.Range("M" & Sheet1.Rows.Count).End(xlUp)).Sort Sheet2.[F2], 1

It should sort all columns (ascending) based on Column F.

I've assumed Sheet1 to be the active sheet. Change this to suit (but please note that Sheet1 is the sheet code not the sheet name).

I hope that this helps.

Cheerio,
vcoolio.
 
Upvote 0
You're welcome Apple08. I'm glad that I was able to help.

Cheerio,
vcoolio.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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