You are here:

Excel/sort multiple sheets


How can I sort multiple sheets, but not all sheets. The workbook contains many individual sheets--one for each student-- each using a table with a date column F. The information is in a table that begins on row 10 and ends at 1006; name, dates, totals are displayed in the first few rows above the table. The sorting needs to be done from time to time on all of the individual student sheets, sorting by date (column F)in ascending order. The workbook contains several other sheets with information of a different type that should not be sorted. Can I specify which sheets are to be sorted by entering something ("sort_code" text for example)in the same cell on each student sheet as they are created which would then signal a macro to sort that sheet by date within the table?
My search led to this answer that is close to what I need:

Bills macro looks like it needs just a minor tweek

for each sh in activeworkbook.sheets
if sh.range("A1").value="sort_code" then
'do the sorting macro
end if
next sh

amend a1 to whatever location you want to use, and possibly add the line


before the end if - this would clear down the instruction to sort.

question found in question pool, indicating the original expert was unable or unwilling to answer the question - hopefully this answer does give you what you need but do let me know if you need further assistance.
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Aidan Heritage


I have provided first hand support since `95 for Microsoft Office majoring in Word and Excel - support for all versions from 2 onwards. I'm based in the UK, so please allow for time differences when asking me questions from other parts of the world!


My background is in the insurance industry and call centre areas, but have been called upon to provide many varied solutions.

I'm educated to UK A level standard, but as I left school some 30 years ago that is rather irrelevent - university of life has provided more of a background!

©2017 All rights reserved.