Worksheet sorting code/technique advise
This Workbook has headers but the handling is the same.
The code belongs to the code module of ThisWorkbook.
Hi Claus,
Moved the code to the ThisWorkbook module and it fires each time a sheet tab is selected.
A puzzling aspect is now, it sorts EVERY column on the sheet despite having say
Case "Sheet1"
MyCol = Array(1, 2, 3, 4, 5)
It sorts 6 on to whatever has data in it. I'm using about 10 to 12 columns in my tests.
Near as I can tell the only thing the code obeys is the first column as the "sort on" column.
I put in 1 to 9 in column A and pulled that over to column P, and manually toggle back and forth to Ascending/Descending in the code and it sorts A through P each time sheet is selected even though 1 to 5 are in the Array.
So it seems the array does not exclude any column after all. It really only sets the "sort on" column.
Howard
|