Microsoft Office Tutorials and References
In Depth Information
Figure 17-8. Augmenting the DataSheet worksheet
' Fill array with worksheet names
For i = 1 To cSheets
sSheets(i) = wb.Sheets(i).Name
' Create new sheet and put names in first column
Set ws = wb.Worksheets.Add
For i = 1 To cSheets
ws.Cells(i, 1).Value = sSheets(i)
' Sort column
ws.Columns(1).Sort Key1:=ws.Columns(1), _
' Refill array
For i = 1 To cSheets
sSheets(i) = ws.Cells(i, 1).Value
' Delete extraneous sheet
Application.DisplayAlerts = False
Application.DisplayAlerts = True
' Reorder sheets by moving each one to the end
For i = 1 To cSheets
wb.Sheets(sSheets(i)).Move After:=wb.Sheets(cSheets)
End Sub
Once the code is inserted, you can save the SRXUtils.xls workbook as an add-in. Don't forget to
unload the add-in first, or Excel will complain.
Search JabSto ::

Custom Search