Skip to content

sortcells

Sort a cell range.

sortcells(cr)
sortcells(cr, sort_options...)

Sorts the cells in cr using the active worksheet’s default sort criterion. Trailing string arguments customize the sort:

  • A eSortOnType value ('Value', 'Color', 'Icon', etc.) selects the sort key
  • A eSortingOrder value ('Ascending' / 'Descending') sets direction
  • 'CaseSensitive' / 'CaseInsensitive' controls string-comparison case
sortcells(A1:A100)
sortcells(A1:A100, 'Descending', 'CaseInsensitive')
  • copycells — Copy a cell range, optionally to a destination range.
  • sortrows — Sort rows of a matrix or table by column values.