メインコンテンツへスキップ

Excelで非表示のシートへのハイパーリンクをたどる方法は?

たとえば、複数のワークシートを含むブックがあり、最初のマスターシートに他のシートへのハイパーリンクがあり、最初のシートを除くすべてのシートを非表示にしています。 この場合、非表示のシートにリンクするハイパーリンクは使用できません。 しかし、どうすればこれらのハイパーリンクを正常に機能させることができますか? ハイパーリンクをXNUMXつクリックすると、次のスクリーンショットのように、リンクされた非表示のシートがすぐに開きます。

非表示シートへのドキュメントハイパーリンク1

ハイパーリンクをたどって、VBAコードで非表示のシートを開きます

ハイパーリンクをたどって非表示のシートを開き、VBAコードで再度非表示にします


ハイパーリンクをたどって、VBAコードで非表示のシートを開きます

次のVBAコードは、相対ハイパーリンクをクリックしたときに非表示のワークシートを開くのに役立つ場合があります。次のようにしてください。

1。 非表示のシートへのハイパーリンクをたどるシートタブを右クリックし、を選択します コードを表示 コンテキストメニューから、ポップアウトで アプリケーション向け Microsoft Visual Basic ウィンドウで、次のコードをコピーして空のモジュールに貼り付けてください。

VBAコード:ハイパーリンクをたどって非表示のシートを開きます。

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Updateby Extendoffice
    Application.ScreenUpdating = False
    On Error Resume Next
    If Target.Column = 1 Then
        Sheets(Target.Value).Visible = xlSheetVisible
        Sheets(Target.Value).Select
    End If
    Application.ScreenUpdating = True
End Sub

非表示シートへのドキュメントハイパーリンク2

Note:上記のコードでは、番号 1 この内 Target.Column = 1の場合Then スクリプトは、ハイパーリンクを含む列番号を示します。必要に応じて変更してください。

2。 次に、このコードウィンドウを保存して閉じます。特定の非表示シートにリンクしているハイパーリンクをクリックすると、非表示シートがすぐに開きます。


ハイパーリンクをたどって非表示のシートを開き、VBAコードで再度非表示にします

場合によっては、ハイパーリンクをたどって非表示のシートを開く必要があり、マスターシートに戻ったときに、開いたシートを再び非表示にする必要があります。 以下のVBAコードはあなたに有利に働くことができます:

1。 非表示のシートへのハイパーリンクをたどるシートタブを右クリックし、を選択します コードを表示 コンテキストメニューから、ポップアウトで アプリケーション向け Microsoft Visual Basic ウィンドウで、次のコードをコピーして空のモジュールに貼り付けてください。

VBAコード:ハイパーリンクをたどって、戻ったときに非表示のシートを開いて、もう一度非表示にします。

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
   'Updateby Extendoffice
    Application.ScreenUpdating = False
    Dim strLinkSheet As String
    If InStr(Target.Parent, "!") > 0 Then
        strLinkSheet = Left(Target.Parent, InStr(1, Target.Parent, "!") - 1)
    Else
        strLinkSheet = Target.Parent
    End If
    Sheets(strLinkSheet).Visible = True
    Sheets(strLinkSheet).Select
    Application.ScreenUpdating = True
End Sub

Private Sub Worksheet_Activate()
    On Error Resume Next
    Sheets(ActiveCell.Value2).Visible = False
End Sub

非表示シートへのドキュメントハイパーリンク3

2。 次に、コードウィンドウに広告を保存します。ハイパーリンクをクリックすると、リンクされた非表示のシートがすぐに開きますが、ハイパーリンクを含むマスターシートに戻ると、開いたシートは再び自動的に非表示になります。

Note:これらのコードは、ハイパーリンクテキストに一致するシート名にのみ適用されます。


デモ:ハイパーリンクをたどって、VBAコードで非表示のシートを開きます

Kutools for Excel:300以上の便利なExcelアドインがあり、30日以内に制限なしで無料で試すことができます。 今すぐダウンロードして無料トライアル!

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
Comments (9)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Not sure if I will get a response to this one, but when I click the any of my hyperlinks I get a "reference isn't valid" error.
Everything still works, I just need to click ok to continue.
Does anyone have an idea what causes this error for this code?
Thank you,
This comment was minimized by the moderator on the site
I have created many wordbook and I want to index those in one page.

N.B: My point is I want to hide all the sheets, the sheets will linked with setting picture to main page. By clicking the picture linked sheet will be shown and when I come back to the main sheet the un-hide sheet will be hidden again
This comment was minimized by the moderator on the site
I would like to use this code but only want it to apply to column A. I have other web address links in other cells which cause a problem when running this code.
This comment was minimized by the moderator on the site
My hyperlink "text" is number only, and it doesn't work...
This comment was minimized by the moderator on the site
I'm using the code on two different sheets. It works for one of about 40 hyperlinks on one sheet and it opens two of about 10 hyperlinks one she second, the sheets on the second which do open do go back into hiding when I return to the sheet. The error I get when it will not open a sheet is Run-time error"9": script out of range and the code it points me to - Sheets(strLinkSheet).Visible = True Any ideas as to what change is needed make the code work on all of the sheets? Thank you in advance.
This comment was minimized by the moderator on the site
I have used this code on two different sheets in my workbook, and in both cases it works great, except for the first hyperlink on each page. I get "Subscript out of range error" and the debugger points to the "Sheets(strLinkSheet).Visible = True" right after the "end if". Anyone else see this error? It is only on the first link on the page. (my hyperlinks are in column A, and start in row 2)
This comment was minimized by the moderator on the site
[quote]I have used this code on two different sheets in my workbook, and in both cases it works great, except for the first hyperlink on each page. I get "Subscript out of range error" and the debugger points to the "Sheets(strLinkSheet).Visible = True" right after the "end if". Anyone else see this error? It is only on the first link on the page. (my hyperlinks are in column A, and start in row 2)By HelzBelz[/quote] Sheet names can't have space like "Sheet 1". I fixed my sheet names to "Sheet1" and the error stopped.
This comment was minimized by the moderator on the site
I have a sheet that is hidden that contains a hyperlink. I would like to be able go to the hidden sheet and have it close when I go back to the original sheet. I used the code but it does not work.
This comment was minimized by the moderator on the site
I am trying to hide a sheet that has a hyperlink. I would like to be able to click on the sheet go to the hyperlink sheet and then click back to the sheet and close the hidden sheet. I have tried your instructions but it does not work. Not sure what I am doing wrong.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations