How to Sort Every Excel Column Independently from Lowest to Highest in WPS Office
Question details
The user needs to sort each column of a large worksheet range independently from lowest to highest without rearranging values in other columns.

- Product
- WPS Office Spreadsheets
- Device & OS
- not provided
- Scenario
- A normal sort moves complete rows; the user wants only each individual column reordered from top to bottom.
- Observed behavior
- A standard Excel sort rearranges complete rows, so it cannot independently sort every column.
Open the workbook in WPS Office Spreadsheets, show the Developer tab if you plan to use VBA, and note whether the selected range includes a header row so you can adjust the macro starting row.
Use a VBA Macro to Sort Each Column Independently
Best when you need a repeatable, native macro solution that does not rely on newer dynamic array functions.
A normal Excel sort rearranges entire rows. This macro loops through each column in the used range and sorts only that column in ascending order, leaving the positions of values in other columns unchanged.
In WPS Office Spreadsheets, press Alt+F11, or click Developer > Visual Basic if the Developer tab is visible.
Click Insert > Module in the VBA editor to create a new code module.
Paste the following code and adjust the start row if your data has headers: Sub SortAllColumns() Dim lastRow As Long, lastColumn As Long, i As Long lastRow = ActiveSheet.Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row lastColumn = ActiveSheet.Cells(1, ActiveSheet.Columns.Count).End(xlToLeft).Column For i = 1 To lastColumn ActiveSheet.Range(ActiveSheet.Cells(1, i), ActiveSheet.Cells(lastRow, i)).Sort Key1:=ActiveSheet.Cells(1, i), Order1:=xlAscending, Header:=xlNo Next i End Sub
Click anywhere inside the Sub SortAllColumns() code and press F5, or go to Run > Run Sub/UserForm.

Sort Columns with a Dynamic Array Formula Workaround
Use this method if your WPS Office or Excel version supports LAMBDA, REDUCE, CHOOSECOLS, and dynamic arrays and you prefer not to run a macro.
Sort Every Column Independently with WPS Office VBA
WPS Office Spreadsheets lets you open your Excel workbook, open the built-in VBA editor, and run a small macro that sorts each column from lowest to highest without moving data across columns.
- 1. Open the workbook: Open your Excel workbook in WPS Office Spreadsheets.
- 2. Open the VBA editor: Press Alt+F11, or click Developer > Visual Basic, to open the VBA editor.
- 3. Create and fill a module: Click Insert > Module and paste the SortAllColumns VBA macro into the new module.
- 4. Run the macro: Place the cursor inside the macro and press F5, or click Run > Run Sub/UserForm, then verify each column is sorted from top to bottom.

Frequently Asked Questions
Can I sort every column independently without using VBA?
Yes, if your spreadsheet version supports LAMBDA, REDUCE, CHOOSECOLS, and dynamic arrays, you can use a dynamic array formula to sort each column and stack the results. Otherwise the VBA macro is the most reliable method.
What should I do if my range has headers?
Adjust the macro so the sort starts at the first data row instead of row 1. For example, change Cells(1, i) to Cells(2, i) and update the lastRow detection to begin in row 2.
Why does a normal Excel sort rearrange all rows when I sort one column?
A normal sort treats each row as a record, so sorting by one column moves the entire row. Independent column sorting is not available through the standard sort dialog and requires a macro or formula.
Will the VBA macro work in WPS Office?
WPS Office on compatible Windows versions supports VBA macros. Open the VBA editor with Alt+F11 or Developer > Visual Basic, insert a module, paste the code, and run the macro.
Does the dynamic array formula work in all WPS Office versions?
No, it requires support for LAMBDA, REDUCE, CHOOSECOLS, and dynamic arrays. If you see #NAME? or #CALC!, use the VBA macro solution instead.




