概要
VBE(Visual Basic Editor)を利用して、GETURL関数を自作することで、GETURL(セル番号)によってハイパーリンクの値を取得できるようになります。
![](http://regardie.dev/wp-content/uploads/2021/08/image-1-13.png)
設定方法
①ファイル>オプションの順にクリック
![](http://regardie.dev/wp-content/uploads/2021/08/image-14-1.png)
②「リンクのユーザー設定」をクリックし、「開発」にチェックを入れ、「OK」をクリック
![](http://regardie.dev/wp-content/uploads/2021/08/image-15-1.png)
③画面上部の「開発」タブから「Visual Basic」をクリック
![](http://regardie.dev/wp-content/uploads/2021/08/image-1-16.png)
④下記画像の場所から「標準モジュール」をクリックし、表示された画面に下記コードをコピペ
Function GETURL(lnk As Range) As String
Dim Add As String
If lnk.Hyperlinks.Count > 0 Then
With lnk.Hyperlinks(1)
If .Address Like "http*" Then
Add = .Address
End If
End With
End If
If Add <> "" Then
GetURL = Add
Else
GetURL = ""
End If
End Function
⑤あとはGETURL関数を利用するだけ!
![](http://regardie.dev/wp-content/uploads/2021/08/image-17-1.png)