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
Post a Comment