Help required: Floating button to do a google search

Steven0605

New Member
Joined
Aug 1, 2017
Messages
3
Hi all,

I have a rather large spreadsheet (circa 100k lines) and each line has a different item on it. I need to review each item and make a decision about the department each item would fall into. The problem is that for about 75% of the items I need to do a google search to determine what the item is in the first place.

I guess my question is: Does anyone have any code that would insert a floating button into the spreadsheet, so that when it is clicked it will use the currently selected cells contents and open chrome/IE (or use an already open instance of chrome/IE) and do a google search using the contents of the cell?

My current method is: Select cell, CTRL-C, AltTab to Chrome, CTRL-V in chrome, then review search results. I need to do these reviews a few times a year so I'm hoping to combine the first 4 steps (those in bold) into one quick button click in excel if possible.

Any help is appreciated.

Thanks in advance.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Welcome to the forums!

Here's how I would handle this. Resize your row 1 and insert a button there, label it whatever you want. Freeze row 1, so as you scroll down, the button (and headers) stay visible.

Next, copy the following code into a new module and assign the "GoogleSearch" macro to the button.

Hope this helps!


Code:
Public Sub BrowserPicker(browser As String, URL As String)

Dim iePath  As String, _
    chPath  As String, _
    bPath   As String
    
iePath = Environ$("ProgramW6432") & "\Internet Explorer\iexplore.exe"
chPath = Environ$("ProgramFiles") & "\Google\Chrome\Application\chrome.exe"

Select Case UCase(browser)
    Case "IE"
        bPath = iePath
    Case "CHROME"
        bPath = chPath
    Case Else
        bPath = iePath
End Select

Call Shell(bPath & " " & URL, vbNormalFocus)

End Sub

Public Sub GoogleSearch()
Dim tmpURL      As String, _
    tmpSearch   As String
    
tmpURL = "https://www.google.com/search?q="
tmpSearch = Replace(Selection.Value, " ", "+")

tmpURL = tmpURL & tmpSearch

BrowserPicker "CHROME", tmpURL
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,657
Members
449,462
Latest member
Chislobog

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top