Created
November 14, 2019 05:38
-
-
Save nabinno/5918febda6454b7ffd836a11ac1eafd8 to your computer and use it in GitHub Desktop.
Web search active cell for EXCEL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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