Sheet name sort

Hi,

If you want to re-order sheet, the following code with InvokeCode will help you.

Using wb As New ClosedXML.Excel.XLWorkbook(filename)
Dim sheets As ClosedXML.Excel.IXLWorksheets = wb.Worksheets
Dim arrSheetName  As String() = sheets.Select(Function(s) s.Name).OrderBy(Function(s) CInt(s)).ToArray()
Dim i As int32 =1
For Each  s As String In arrSheetName
	wb.Worksheet(s).Position=i
	i=i+1
Next
wb.Save()
End Using

note: this assumes all the sheet names consist of numeric characters.

Sample
Sequence.xaml (6.0 KB)

Regards,