I'm trying to use vba to sort tabs in Excel, but I'm not familiar enough with writing the code to alter existing answers that I've found online.
I have multiple Excel files, each with different numbering systems. Those include Item (#ofsheet), so like Item (1), Item (8), Item (28). Those organize themselves by Item 1, 28, and 8 when I try existing codes, when it should be 1, 8, 28.
Would someone help me with the code for this? Thank you.
Edit: my apologizes, I wrote this on my phone originally. This code is working for me to get the items into a Item (1), Item (11), Item (2), Item (34) order.
Sub sortAscendinfg()
Dim i, N, k As Double
'Count the number of worksheets and store the number in variable "n"
N = Application.Sheets.Count
'Do the following look for each worksheet again
For i = 1 To N
'Loop through all worksheets until the second last one (later you use the .move after function)
For k = 1 To N - 1
'If the name is larger than the following worksheet, change the sequence of these two worksheets.
'In order to enable a proper comparison, change all characters to lower case (UCase = Upper case works
'the same way.
If LCase(Sheets(k).Name) > LCase(Sheets(k + 1).Name) Then Sheets(k).Move After:=Sheets(k + 1)
Next
Next
End Sub