fredrerik84
Active Member
- Joined
- Feb 26, 2017
- Messages
- 383
Ive extracted around 100 rows of string where the strings come out like this in excel (in one cell)
"
I dag 17:00
2.200
Tottenham Hotspur
3.600
X
3.700
Chelsea
I dag 14:30
2.850
Huddersfield Town
3.200
X
2.750
Newcastle United
+ 298
I dag 17:00
2.150
Tottenham Hotspur
3.500
X
3.600
Chelsea
+ 283
I tried to splitting it the following way:
Unfortunately for me this will only extract data for one Row
1word goes into cell A (date)
2 word goes to cell E ( teamA)
3 word goes to cell G ( teamB)
4th word goes to cell j
5th word goes to cell k
6th word goes to cell l
Is there a better way to split this string ?
also the length of the string will different from row to row.
Any help with this will be much appreciated
"
I dag 17:00
2.200
Tottenham Hotspur
3.600
X
3.700
Chelsea
I dag 14:30
2.850
Huddersfield Town
3.200
X
2.750
Newcastle United
+ 298
I dag 17:00
2.150
Tottenham Hotspur
3.500
X
3.600
Chelsea
+ 283
I tried to splitting it the following way:
Code:
For i = 0 To HTMLRows5.Length - 1
On Error Resume Next
str = HTMLRows(i).innerText
Cells(j, "B").value = Trim(Split(HTMLRows(i).innerText, vbCrLf)(2))
Cells(j, "J").value = Trim(Split(HTMLRows(i).innerText, vbCrLf)(5))
Cells(j, "E").value = Trim(Split(HTMLRows(i).innerText, vbCrLf)(6))
Cells(j, "K").value = Trim(Split(HTMLRows(i).innerText, vbCrLf)(9))
Cells(j, "L").value = Trim(Split(HTMLRows(i).innerText, vbCrLf)(13))
Cells(j, "G").value = Trim(Split(HTMLRows(i).innerText, vbCrLf)(14))
j = j + 1
Next i
Unfortunately for me this will only extract data for one Row
1word goes into cell A (date)
2 word goes to cell E ( teamA)
3 word goes to cell G ( teamB)
4th word goes to cell j
5th word goes to cell k
6th word goes to cell l
Is there a better way to split this string ?
also the length of the string will different from row to row.
Any help with this will be much appreciated
Last edited: