Sub ブック_INDEX() 'シートのINDEXを作成する。 Dim s As Worksheet Dim i As Integer Dim w_sheet As Worksheet '■■■■■■■■■■■■■■■■■ Application.DisplayAlerts = False Application.EnableEvents = False Application.ScreenUpdating = False Application.Calculation = xlCalculationManual '■■■■■■■■■■■■■■■■■ On Error Resume Next Sheets("INDEX").Delete On Error GoTo 0 Sheets.Add Before:=Sheets(1) Set s = ActiveSheet s.Name = "INDEX" s.Cells.ColumnWidth = 2 i = 1 For Each w_sheet In Sheets Application.StatusBar = "ハイパーリンク作成 " & i & "/" & Sheets.Count s.Cells(i, 1) = w_sheet.Index s.Cells(i, 2) = "'" & w_sheet.Name ActiveSheet.Hyperlinks.Add _ Anchor:=s.Cells(i, 2), Address:="", SubAddress:="'" & s.Cells(i, 2).Value & "'!A1", TextToDisplay:="'" & s.Cells(i, 2).Value If w_sheet.Visible = xlSheetHidden Then s.Cells(i, 2).Interior.ColorIndex = 15 '灰色 End If s.Cells(i, 3).Value = w_sheet.Cells.SpecialCells(xlCellTypeLastCell).row s.Cells(i, 4).Value = w_sheet.Cells.SpecialCells(xlCellTypeLastCell).Column i = i + 1 Next w_sheet For Each w_sheet In Sheets If w_sheet.Name <> "INDEX" Then w_sheet.Activate If w_sheet.Range("A1") = "※" Then w_sheet.Range("A1") = "" End If w_sheet.Range("A1").Select End If i = i + 1 Next w_sheet Sheets("INDEX").Activate For Each w_sheet In Sheets w_sheet.Activate ActiveWindow.LargeScroll ToLeft:=99 ActiveWindow.LargeScroll Up:=99 w_sheet.Range("A1").Select Next w_sheet
With Sheets("INDEX") .Range("C1").Value = "行数" .Range("D1").Value = "列数" End With
s.Activate s.Cells.Font.Name = "Meiryo UI" s.Cells.EntireColumn.AutoFit Rows("2:2").Select ActiveWindow.FreezePanes = True Columns("B:B").Select Selection.AutoFilter s.Cells(1, 1).Select
'■■■■■■■■■■■■■■■■■ Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True Application.EnableEvents = True Application.DisplayAlerts = True Application.StatusBar = False '■■■■■■■■■■■■■■■■■
End Sub