Tom’s Tutorials for Excel:How to sort your sheet tabs in alphanumeric ascending order
Happy Friday! Here is today’s useful Excel solution from Tom Urtis
Sub SortSheetsTabName() Application.ScreenUpdating = False Dim iSheets%, i%, j% iSheets = Sheets.Count For i = 1 To iSheets - 1 For j = i + 1 To iSheets If Sheets(j).Name < Sheets(i).Name Then Sheets(j).Move before:=Sheets(i) End If Next j Next i Application.ScreenUpdating = True End Sub
Remember, you can follow Tom Urtis on Twitter @TomUrtis and on Facebook Tom Urtis/ Atlas
how do you call it and apply it to a specific workbook? (as in running a master code in one master workbook when processing other workbooks’ content).
Thanks!
It depends on how fancy or robust you want (or need) the code to be. And that depends on if the workbook is open or not,, and if it is closed what is its path and name, and if it is open is it the only open other workbook or maybe there could be ten other open workbooks in which case you would need an interface to tell you which workbooks are open so you can pick the specific workbook you want. I have posted code examples for all these scenarios on my blog so it depends on the situation.