Hi all,

I would like to program an Excel function that supports a Google search for search criteria, which are stored in Excel worksheet.

The function should return a hyperlink to google and conduct a google search upon clicking the hyperlink.

Public Function gs(sSearchstring As String, Optional sGooglesite = "de")
    Dim sGoogle, sGoogle1, sGoogle2, sURL As String
    'please replace "URL of google" with the URL of google, as I am
    'not allowd to post links
    sGoogle = "URL of google/search?hl=" & sGooglesite & "&q="
    sGoogle2 = "&btnG=Google-Suche&meta="
    sGoogle1 = Replace(sSearchstring, " ", "+")
    sURL = sGoogle & sGoogle1 & sGoogle2
    gs = sURL
End Function
The function above returns the correct URL in form of a string. How can I adjust the function to return a hyperlink instead of the string? I am aware that =hyperlink(gs("search criteria")) delivers the desired result, but this solution is not very userfriendly.

I really would appreciate your help, as I don't how to address this problem.


Thanks