You are here:

Excel/Sorting with VBA 2010


Hi Bob,

I am using Excel 2010 and using VBA. I have a problem with my sort statement:

 Range("B2:E20").Sort Key1:=Range("B2:E20").Range("C2"), Order1:=xlAscending, Header:=xlNo

I want to sort the entire range (B2:E20) in ascending order by the alphabetic contents of column C.

Can you help me, please?

If you need more information, please let me know.

Thank you.


Range("B2:E20").Range("C2") is actually cell D3 (honest!)
You want
Range("B2:E20").Sort Key1:=Range("C2"), Order1:=xlAscending, Header:=xlNo

Further example: Range("F1:Z1000").Range("A1") is actually cell F1. The first part is the "universe". In the universe of F1:Z1000, cell A1 is the top left cell, or F1.
So in your universe of B2:E20, cell C2 is 2nd row, 3rd column (of the universe), of cell D3.  
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Bob Umlas


I`m a Microsoft Excel MVP (Most Valuable Professional) and have been since the inception of the program in 1995. I can answer every kind of Excel question except: API, Importing/exporting to other programs (powerpoint, word,...) Also check out my in-person training link at


Worked with MS Excel since version 0.99 (on the Mac!). Was contributing editor to Excellence Magazine, having written >300 articles. John Walkenbach said of me "I finally met someone who knows as much about Excel as I do."

Excellence, The Expert, Microsoft

BA in math, Hofstra University, 1965

Awards and Honors
Led sessions for the Convergence 2004-2006 seminar on Excel tips & tricks

©2016 All rights reserved.