I'm having a lot of trouble trying to get a simple webscrape to work.
I am using a dynamic URL to search for a product (in this case 'GREENE KING ABBOT ALE') and what I'd like to do is have all the available links (HRef's) that return from the site to appear in column A of sheet called 'Single'
My browser (Chrome) shows me a particular URL on the page:
however I can't get this particular link to copy into my sheet.
Please can you help - spent all day getting this far and I'm running out of ideas
Would be so grateful!!
- Sub webscrape()
- Dim doc As HTMLDocument
- Dim output As Object
- Set IE = CreateObject("InternetExplorer.Application")
- 'Set IE = New InternetExplorer
- IE.Visible = False
- IE.Navigate "https://groceries.aldi.co.uk/en-GB/Search?keywords=GREENE+KING+ABBOT+ALE"
- Loop Until IE.ReadyState = READYSTATE_COMPLETE
- Set doc = IE.Document
- Set output = doc.getElementsByTagName("a")
- i = 5
- For Each Link In output
- Sheets("Single").Range("A" & i).Value = Link
- i = i + 1
- End Sub