ワークシートについて | 標準のシート数を変更する |
シート名を一覧表示して選択する | シート名をシートに書き出したい |
Sub Sample1() Dim mySheet As Worksheet Dim cn As Long For Each mySheet In ThisWorkbook.Worksheets cn = cn + 1 Sheets("Sheet1").Cells(cn, 1).Value = mySheet.Name Next End Sub '------------------ Sub Sample2() Dim mySheet As Object Dim cn As Long For Each mySheet In ThisWorkbook.Sheets cn = cn + 1 Sheets("Sheet1").Cells(cn, 2).Value = mySheet.Name Next End Sub '------------------ Sub sample3() Dim i For i = 1 To Sheets.Count Sheets("Sheet1").Cells(i, 3) = Sheets(i).Name Next i End Sub |
Sub Sample4() Dim i As Integer For i = 1 To Worksheets.Count Worksheets("Sheet1").Hyperlinks.Add _ anchor:=Cells(i, 1), _ Address:="", _ SubAddress:=Worksheets(i).Name & "!A1", _ TextToDisplay:=Worksheets(i).Name Next i End Sub |