Skip to content

Instantly share code, notes, and snippets.

@nabinno
Created November 14, 2019 05:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nabinno/5918febda6454b7ffd836a11ac1eafd8 to your computer and use it in GitHub Desktop.
Save nabinno/5918febda6454b7ffd836a11ac1eafd8 to your computer and use it in GitHub Desktop.
Web search active cell for EXCEL
Sub WebSearchActiveCell()
Dim cs As Range
Dim c As Range
Dim query As String
If ActiveWindow.RangeSelection.Count = 1 Then
Set cs = ActiveWindow.RangeSelection
Else
Set cs = ActiveWindow.RangeSelection.SpecialCells(xlCellTypeVisible)
End If
For Each c In cs
query = c.Value
If Not query = "" Then
doWebSearchActiveCell query
End If
Next
End Sub
Sub doWebSearchActiveCell(query)
Dim strURL
strURL = "https://www.google.co.jp/search?q="
ActiveWorkbook.FollowHyperlink Address:=strURL & query
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment