Sub SortSheets2()
Dim wb As Workbook
Dim wsList As Worksheet
Dim sheetNames() As Variant
Dim i As Integer
' エクセルブックをセット
Set wb = ThisWorkbook
' シートリストを取得
Set wsList = wb.Sheets("Sheet1")
' シート名を配列に格納
sheetNames = wsList.Range("A10", wsList.Cells(wsList.Rows.Count, "A").End(xlUp)).Value
' シートを並び替え
For i = UBound(sheetNames, 1) To LBound(sheetNames, 1) Step -1
wb.Sheets(sheetNames(i, 1)).Move before:=wb.Sheets(1)
Next i
End Sub
コメントを残す