Forum Discussion
PaulOlsen
Aug 16, 2020Copper Contributor
Adjusting a sheet sorting macro to sort every sheet except for one
Hi Community! I'm in the final phase of uni assignment requiring us to build some macros, and I've decided on a macro that creates a table of contents, and one that sorts all sheets alphabetically. ...
SqueakySneakers
Aug 17, 2020Brass Contributor
Hi Paul,
This is off the top of my head without getting into the VBA too much.
Instead of trying to exclude the table of contents, can you let it sort it, then add a script that will move it to the position desired?
Worksheets("TOC").Move _ before:=Worksheets("Sheet1") - or use "after" in place of "before"
Then add more code to select that sheet (and a cell within it?).
sheets("TOC").select
'Range("A1").Select <if desired, remove the ' >
If the sorting causes the first page to get moved around, then create a false front page that will always appear first and keep it hidden to use as an "achor".