I'm scraping football score predictions that include a "Season to date (STD)" Win-Loss record. I haven't figured out how to tell excel that "2-4" isn't Feb 4th. Snipet of code below. My question is about the first line inside the For loop. I've also tried Cstr( ) instead of the '& "'
weeksht is a worksheet variable
rNum and cNum are the row and column counters
i is another counter
htmlElement is an object.
stdSpreadHome is a string containing the Class name.
The code works fine, it's just the formatting of the value that is the problem. I need the first line under the For to return "2-4", not "2/4/20". I can't format the destination cell outside the macro because it also creates the worksheet.
Thanks
weeksht is a worksheet variable
rNum and cNum are the row and column counters
i is another counter
htmlElement is an object.
stdSpreadHome is a string containing the Class name.
The code works fine, it's just the formatting of the value that is the problem. I need the first line under the For to return "2-4", not "2/4/20". I can't format the destination cell outside the macro because it also creates the worksheet.
Thanks
VBA Code:
Set htmlElement = ie.document.getElementsByClassName(stdSpreadHome)
For Each n In htmlElement
weekSht.Cells(rNum, cNum).Value = htmlElement(i).innerText & ""
rNum = rNum + 1
i = i + 1
Next