LoginSignup
1
5

More than 5 years have passed since last update.

Excelで選択セル内容をGoogle検索するショートカット

Last updated at Posted at 2015-11-13

'ショートカットに登録すると人によっては便利です。
'選択セル内容をgoogle検索する
Sub Google()
Dim myword As String
Dim myurl
myword = Selection(1).Value
'urlの時はそのまま表示
If Left(Trim(myword), 4) = "http" Then
myurl = Trim(myword)
'それ以外はGoogle検索
Else
myurl = "https://www.google.co.jp/search?q=" & UrlEncodeUtf8(myword)
End If
CreateObject("wscript.shell").Run myurl
End Sub

'URL文字列をUtf8でエンコードする関数
Function UrlEncodeUtf8(ByRef strSource As String) As String
Dim objSC As Object
Set objSC = CreateObject("ScriptControl")
objSC.Language = "Jscript"
UrlEncodeUtf8 = objSC.CodeObject.encodeURIComponent(strSource)
Set objSC = Nothing
End Function

1
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
5