0

I would like to include a variable in a Google search URL. The URL, at present is:

IE.Navigate "https://www.google.com/search?q=DNR-12-1G+$+Price"

How would I replace the emboldened URL text with a defined string variable such as "pn"? Thanks

1
  • PS - I would also like to know how to replace the above with the contents of a cell. Commented Aug 13, 2016 at 12:32

1 Answer 1

1

To use a variable all you need is to substitute the text with it

IE.Navigate "https://www.google.com/search?q=" & pn & "+$+Price" 

That would do the job. If you wanted to use the content of a cell, either set pn to the cell value like this:

pn = ThisWorkbook.Worksheets(1).Range("A1").Value

Adjust as necessary for your worksheet and cell address... or refer to it directly in the Navigate step:

IE.Navigate "https://www.google.com/search?q=" & ThisWorkbook.Worksheets(1).Range("A1").Value & "+$+Price" 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.