-7

firstly I can see that there is a vast amount of questions across multiple websites asking this same question, so please be patient with me as unfortunately the ones I have seen have either not been suitable or don't work and I am far from an expert.

to give you the full scenario - I have an xlsheet with a massive list of unique identifiers for products for the company I work for sells. I have to (at the moment) manually copy from the sheet to google to see its position in the results.

What would be great is to get a vba code that when I run it (hotkey it), automatically takes the cell contents and sends it into a google search so i effectively reduce my 3 clicks and ctrlV into one hotkey.

halfer
  • 19,824
  • 17
  • 99
  • 186
n.coram
  • 21
  • 1
  • 2
  • 1
    How many rows could the table has? I mean how many phrases would you like to search? Btw. You could try at least. It seems, that you just want to someone to write the code instead of you. – Srpic Apr 17 '18 at 10:16
  • 2
    Possible duplicate of [Using VBA in Excel to Google Search in IE and return the hyperlink of the first result](https://stackoverflow.com/questions/17495644/using-vba-in-excel-to-google-search-in-ie-and-return-the-hyperlink-of-the-first) – Pᴇʜ Apr 17 '18 at 10:41
  • @Srpic it has 10,321, and I only need to search the content of one cell at a time, they are actually manufacturer codes so i need to search each code individually. And yes.... I want to someone to write the code instead of me, as I am an ignoramus and don't know how to do it, i am simply trying to make a hard job easier :( – n.coram Apr 17 '18 at 11:08
  • @PEH thanks dude, I have had a good look at this one, along with many others. I don't need to return hyperlinks, simply click a cell and from there it opens google on my browser with the search results of the content of the cell so it isn't overly suitable, in some ways what I need is actually simpler than what that VBA is doing. Appreciate the thought though – n.coram Apr 17 '18 at 11:11

2 Answers2

1

There's no need for VBA if all you want to do is open a Google search page one at a time.

With your search phrase in A1, use this formula, for example:

=HYPERLINK("http://www.google.com/search?q=" & A1,A1)

and fill down as far as required.

That will put a clickable link in column B, corresponding to the search phrase in column A.

Ron Rosenfeld
  • 53,870
  • 7
  • 28
  • 60
0

Here is the code:

Sub Google_search()

Dim IE As Object

  Set IE = CreateObject("InternetExplorer.Application")

  IE.navigate ("http://www.google.com/search?q=" & Cells(1, 1)) 'it will search for value, what is in column A1

  IE.Visible = True


End Sub

Arrange the part Cells(1, 1) for the cell, what you really want to search.

Srpic
  • 450
  • 5
  • 13
  • 29