vba - Sorting a Range of Data -


this code sorting range of data based on column e values

sub sortbylevel()     activeworkbook.worksheets("sheet1").sort.sortfields.clear    activeworkbook.worksheets("sheet1").sort.sortfields.add  key:=range("e13:e528" _     ), sorton:=xlsortonvalues, order:=xlascending, dataoption:=xlsortnormal     activeworkbook.worksheets("sheet1").sort       .setrange range("a12:l528")       .header = xlyes       .matchcase = false       .orientation = xltoptobottom       .sortmethod = xlpinyin       .apply   end  end sub 

note b12:l12 range of headers. have impression can more simpler that. suggestions appreciated. thanks, michael

use :

range("a12:l528").sort key1:=range("e13"), order1:=xlascending, header:=xlyes 

Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -