Option Explicit
Sub Getlink()
Dim ie As New InternetExplorer
Dim lastrow As Integer
Dim i As Integer
lastrow = Range("B" & Rows.Count).End(xlUp).Row
For i = 3 To lastrow
ie.Visible = False
ie.navigate "https://www.google.com/search?q=" & Cells(i, 2)
While ie.Busy Or ie.readyState < 4: DoEvents: Wend
Cells(i, 3).Value = ie.document.querySelector("#search div.r [href*=http]").href
Next
End Sub