crazyeyeschase
Board Regular
- Joined
- May 6, 2014
- Messages
- 104
- Office Version
- 365
- Platform
- Windows
I may be looking to deep at his but essentially I am getting a value (Price) from a websites source code, cleaning that info up, and then need to convert the value into USD.
If need be I could simply create a new column for for aesthetics I would like all conversions to be on one page. I have the conversion rate on sheet6 B2
This code does not have any attempts at converting the price just simply inputs it.
If need be I could simply create a new column for for aesthetics I would like all conversions to be on one page. I have the conversion rate on sheet6 B2
This code does not have any attempts at converting the price just simply inputs it.
VBA Code:
Sub LPwilliams()
Dim IE As Object
Dim Price As String
Dim i As Long
Set IE = CreateObject("internetexplorer.application")
For i = 1 To Range("A" & Rows.Count).End(xlUp).Row
With IE
.Navigate ("https://www.triumph-spares.co.uk/search?q=" & Cells(i, "A").Value)
.Visible = False
End With
Do While IE.readystate <> 4: Wait 5: Loop
DoEvents
On Error Resume Next
Price = IE.document.getElementsByClassName("price price-new")(0).innertext
Cells(i, "C").Value = Price
If Err.Number = 91 Then
Cells(i, "C").Value = "N/A"
End If
Cells(i, "C").Replace What:="EX VAT", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells(i, "C").Replace What:="£", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Next
End Sub