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

Excelでハイパーリンクをあるセルから別のセルにのみコピーするにはどうすればよいですか?

列Aに値のリストがあり、各セルに異なるハイパーリンクが含まれているとすると、次のスクリーンショットに示すように、テキストのないハイパーリンクのみを別の列Eにコピーします。 Excelでこのジョブを直接解決する方法はないかもしれませんが、ここでは、それを処理するためのVBAコードを紹介します。

別のセルへのドキュメントコピーハイパーリンク1

VBAコードを使用してハイパーリンクをあるセルから別のセルにコピーする


矢印青い右バブル VBAコードを使用してハイパーリンクをあるセルから別のセルにコピーする

テキストなしのハイパーリンクアドレスのみを他のセルにコピーするには、次のコードを使用してください。

1。 を押し続けます Alt + F11 キーを押して アプリケーション向け Microsoft Visual Basic 窓。

2に設定します。 OK をクリックします。 インセット > モジュール、次のコードをに貼り付けます モジュール 窓。

VBAコード:あるセルから別のセルにのみハイパーリンクをコピーします。

Sub CopyHyperlinks()
'Uodateby Extendoffice
    Dim xSRg As Range
    Dim xDRg As Range
    Dim I As Integer
    Dim xAddress As String
    On Error Resume Next
    xAddress = ActiveWindow.RangeSelection.Address
    Set xSRg = Application.InputBox("Please select the original range you want to copy hyperlinks:", "KuTools For Excel", xAddress, , , , , 8)
    If xSRg Is Nothing Then Exit Sub
    Set xDRg = Application.InputBox("Please select the new range you want to paste the hyperlinks only", "KuTools For Excel", , , , , , 8)
    If xDRg Is Nothing Then Exit Sub
    Set xDRg = xDRg(1)
    For I = 1 To xSRg.Count
        If xSRg(I) <> "" And xDRg.Offset(I - 1) <> "" Then
            If xSRg(I).Hyperlinks.Count = 1 Then
                xDRg(I).Hyperlinks.Add xDRg(I), xSRg(I).Hyperlinks(1).Address
            End If
        End If
    Next
End Sub

3。 そして、 F5 このコードを実行するためのキーを押すと、ハイパーリンクのみをコピーするセルを選択するように促すダイアログボックスが表示されます。スクリーンショットを参照してください。

別のセルへのドキュメントコピーハイパーリンク02

4。 そして、 OK、次に、ハイパーリンを別のダイアログボックスにのみ貼り付けるセルを選択します。スクリーンショットを参照してください。

別のセルへのドキュメントコピーハイパーリンク03

5。 また、ハイパーリンクアドレスは、必要に応じて元のセルから指定されたセルにコピーされています。スクリーンショットを参照してください。

別のセルへのドキュメントコピーハイパーリンク04

Note:このコードは、必要に応じて、あるシートから別のシートにハイパーリンクをコピーするのにも役立ちます。

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

🤖 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 (13)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I made the following edits to work for my use case:
Sub CopyHyperlinks()
'Uodateby Extendoffice
Dim xSRg As Range
Dim xDRg As Range
Dim I As Integer
Dim xAddress As String
On Error Resume Next
xAddress = ActiveWindow.RangeSelection.Address
Set xSRg = Application.InputBox("Please select the original range you want to copy hyperlinks:", "KuTools For Excel", xAddress, , , , , 8)
If xSRg Is Nothing Then Exit Sub
Set xDRg = Application.InputBox("Please select the new range you want to paste the hyperlinks only", "KuTools For Excel", , , , , , 8)
If xDRg Is Nothing Then Exit Sub
Set xDRg = xDRg(1)
For I = 1 To xSRg.Count
If xSRg(I).Hyperlinks(1).Address <> "" Or xSRg(I).Hyperlinks(1).SubAddress <> "" Then
If xSRg(I).Hyperlinks.Count = 1 Then
xDRg(I).Hyperlinks.Add Anchor:=xDRg(I), _
Address:=xSRg(I).Hyperlinks(1).Address, _
SubAddress:=xSRg(I).Hyperlinks(1).SubAddress
'ScreenTip:=xSRg(I).Hyperlinks(1).ScreenTip, _
'TextToDisplay:=xSRg(I).Hyperlinks(1).TextToDisplay
End If
End If
Next
End Sub
This comment was minimized by the moderator on the site
OK, so you won't publish my comment - which is fair. But if you want me to register and log in, then you need to show me solutions that work, because (on the basis of one non-working instance) I've seen nothing to persuade me that there's any value in registering.
This comment was minimized by the moderator on the site
Doesn't work for me; does the fact that I'm still using Excel 2007 matter?
This comment was minimized by the moderator on the site
This is awesome and it works. I love copy&pasting other people's code :D
This comment was minimized by the moderator on the site
This didn't work for me either.
This comment was minimized by the moderator on the site
Lets say in your cell A1 is hyperlink, so to get the path of the hyperlink just create formula like below:
>> (MID((FORMULATEXT(A1));(FIND("(";(FORMULATEXT(A1)))+2);(FIND(";";(FORMULATEXT(A1)))-1)-(FIND("(";(FORMULATEXT(A1)))+2))) <<
This comment was minimized by the moderator on the site
Doesn't work.
This comment was minimized by the moderator on the site
Love it. Thank you so muchoooo.
Love From Dominican Republic :)
This comment was minimized by the moderator on the site
Doesn't work.
This comment was minimized by the moderator on the site
hello.. what if i want to copy the hyperlink through vlookup? i already have the formula but when i click the the hyperlink it "cannot open specied file" will appear.

Please help me
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations