目次
How to Create a Dynamic Table of Contents in Excel

Excelで目次を作成する方法

Mar 24, 2025 am 08:01 AM

A table of contents is a total game-changer when working with large files – it keeps everything organized and easy to navigate. Unfortunately, unlike Word, Microsoft Excel doesn’t have a simple “Table of Contents” button that adds this handy feature and updates it automatically. No, you’ll have to roll up your sleeves and create a dynamic table of contents yourself. This table will automatically update and contain clickable links, allowing you to add and remove sheets – as well as jump between them – with ease. This guide has all the info you need to create a dynamic table of contents in Excel.

How to Create a Dynamic Table of Contents in Excel

Technically, there are three ways to create a dynamic table of contents (TOC) in Excel. However, only one of them guarantees a fully automated TOC, and that’s Visual Basic for Applications or VBA for short – Microsoft’s native programming language. The other two – traditional formulas and Power Query – will give you a semi-dynamic table of contents in Excel – one that either doesn’t include clickable links or doesn’t update automatically. Since we’re after a fully dynamic Excel table of contents, we’ll use VBA.

If you aren’t particularly VBA-savvy; don’t worry – you just need to follow a few steps. But first – let’s create our table of contents.

Step 1: Click on the “Insert Worksheet” button next to your sheets at the bottom.

Excelで目次を作成する方法

Step 2: Name the sheet “Table of Contents.”

Excelで目次を作成する方法

Step 3: Drag the sheet to the first position for better navigation.

Excelで目次を作成する方法

Step 4: Enter the names of your sheets in Column A of the “Table of Contents” sheet.

Excelで目次を作成する方法

And voilà – you’ve got your table of contents. You can play with the aesthetics of this TOC later – now, we need to make it dynamic. To do so, we’ll need the help of the VBA Editor – a built-in Excel tool that lets you write and run custom codes.

Step 1: Press “Alt + F11” to open the VBA Editor.

Excelで目次を作成する方法

Step 2: Go to the “Insert” tab at the top.

Excelで目次を作成する方法

Step 3: Select “Module” from the dropdown menu.

Excelで目次を作成する方法

Step 4: Copy and paste the following VBA code:

Sub CreateTOC()

    Dim ws As Worksheet

    Dim toc As Worksheet

    Dim i As Integer

    ‘ Check if TOC sheet already exists, delete if it does

    On Error Resume Next

    Set toc = ThisWorkbook.Sheets(“Table of Contents”)

    On Error GoTo 0

    If Not toc Is Nothing Then Application.DisplayAlerts = False: toc.Delete: Application.DisplayAlerts = True

    ‘ Create new TOC sheet

    Set toc = ThisWorkbook.Sheets.Add(Before:=ThisWorkbook.Sheets(1))

    toc.Name = “Table of Contents”

    ‘ Set up TOC header

    toc.Cells(1, 1).Value = “Table of Contents”

    toc.Cells(1, 1).Font.Bold = True

    toc.Cells(1, 1).Font.Size = 14

    ‘ Loop through all sheets and add hyperlinks

    i = 2

    For Each ws In ThisWorkbook.Sheets

        If ws.Name <> “Table of Contents” Then

            toc.Hyperlinks.Add Anchor:=toc.Cells(i, 1), _

                Address:=””, _

                SubAddress:=”‘” & ws.Name & “‘!A1”, _

                TextToDisplay:=ws.Name

            i = i + 1

        End If

    Next ws

    ‘ Adjust column width

    toc.Columns(“A”).AutoFit

 End Sub

Excelで目次を作成する方法

Step 5: Hit “F5” to run the code.

Step 6: Exit the VBA Editor.

You’ll notice your Excel table of contents is now clickable.

Excelで目次を作成する方法

To automatically update your table of contents after changes, you just need to repeat Steps 1 to 6. This will add any new sheets to the list or remove the ones you deleted.

Excelで目次を作成する方法

以上がExcelで目次を作成する方法の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

Microsoftの新しいPowertoys検索は不足している機能Windows11のニーズです Microsoftの新しいPowertoys検索は不足している機能Windows11のニーズです Apr 03, 2025 am 03:53 AM

Microsoftの最新のPowertoysアップデートでは、Macosのスポットライトを連想させるゲームを変える検索機能を紹介します。 この改善された「コマンドパレット」(以前のPowertoys Run)は、Windows R runコマンドとタスクの機能を上回ります

Windows KB5054979更新情報の更新コンテンツリスト Windows KB5054979更新情報の更新コンテンツリスト Apr 15, 2025 pm 05:36 PM

KB5054979は、Windows 11バージョン24H2のために、2025年3月27日にリリースされた累積セキュリティアップデートです。 .NETフレームワークバージョン3.5および4.8.1をターゲットにし、セキュリティと全体的な安定性を高めます。特に、更新はファイルと直接の問題に対処します

Nanoleafは、技術の充電方法を変更したいと考えています Nanoleafは、技術の充電方法を変更したいと考えています Apr 17, 2025 am 01:03 AM

Nanoleafのペグボードデスクドック:スタイリッシュで機能的なデスクオーガナイザー 同じ古い充電セットアップにうんざりしていませんか? Nanoleafの新しいPegboard Desk Dockは、スタイリッシュで機能的な代替品を提供しています。 この多機能デスクアクセサリーは、32のフルカラーRGBを誇っています

Dell Ultrasharp 4K Thunderbolt Hub Monitor(U2725QE)レビュー:最高のLCDモニターI&#039; VEテスト Dell Ultrasharp 4K Thunderbolt Hub Monitor(U2725QE)レビュー:最高のLCDモニターI&#039; VEテスト Apr 06, 2025 am 02:05 AM

DellのUltrasharp 4K Thunderbolt Hubモニター(U2725QE):OLEDに匹敵するLCD 何年もの間、私はOLEDモニターを切望してきました。 しかし、Dellの新しいUltrasharp 4K Thunderbolt Hubモニター(U2725QE)は私の考えを変え、その印象で期待を上回りました

Windows11をBluetoothオーディオレシーバーとして使用する方法 Windows11をBluetoothオーディオレシーバーとして使用する方法 Apr 15, 2025 am 03:01 AM

Windows 11 PCをBluetoothスピーカーに変え、お気に入りの音楽をお使いのお気に入りの音楽をお楽しみください!このガイドは、iPhoneまたはAndroidデバイスをコンピューターに簡単に接続してオーディオ再生を示します。 ステップ1:Bluetoothデバイスをペアリングします まず、PA

これらは有料のWindowsアプリのための私の無料の代替品です これらは有料のWindowsアプリのための私の無料の代替品です Apr 04, 2025 am 03:42 AM

多くの無料アプリは、有料のカウンターパートに匹敵します。 このリストには、人気のある有料ソフトウェアの優れた無料のWindowsの代替品が紹介されています。 有料のオプションが重要で欠落している機能を提供しない限り、フリーソフトウェアを使用することを固く信じています。 これら

Alienware 27 4K QD-OLED(AW2725Q)レビュー:ピクセル密度の新しい標準 Alienware 27 4K QD-OLED(AW2725Q)レビュー:ピクセル密度の新しい標準 Apr 08, 2025 am 06:04 AM

エイリアンウェア27 4K QD-OLED(AW2725Q):見事な高密度ディスプレイ 27インチモニターの899.99ドルの値札は急勾配に見えるかもしれませんが、Alienware AW2725Qの例外的なピクセル密度は、ゲームとすべての両方に変革的な体験を提供します

使用する必要がある5つの隠されたWindows機能 使用する必要がある5つの隠されたWindows機能 Apr 16, 2025 am 12:57 AM

よりスムーズな体験のために、隠されたWindows機能のロックを解除してください! コンピューティングエクスペリエンスを大幅に向上させることができる驚くほど便利なWindows機能を発見してください。ベテランのWindowsユーザーでさえ、ここでいくつかの新しいトリックを見つけるかもしれません。 ダイナミックロック:自動

See all articles