hello all,
i currently have a macro set to open a webpage, search and return data to a specific cell and add the next result in the next row and then format each result to trim out the first 16 characters, what i'm hoping to do is return the results all in the same cell with each result having been trimmed and then separated by a comma and space. the table below shows what the final product should look like (the BW1 Trim Column), also posted the relevant code i have so far.
<tbody>
</tbody>
i currently have a macro set to open a webpage, search and return data to a specific cell and add the next result in the next row and then format each result to trim out the first 16 characters, what i'm hoping to do is return the results all in the same cell with each result having been trimmed and then separated by a comma and space. the table below shows what the final product should look like (the BW1 Trim Column), also posted the relevant code i have so far.
BW 1 Results | BW 1 (Trim) |
Reg Date: 09/26/2005 | 2005, 2007, 2009 |
Reg Date: 10/26/2007 | |
Reg Date: 11/26/2009 |
<tbody>
</tbody>
Code:
Set TDelements = HTMLDoc.getElementsByTagName("TD")
For Each TDelement In TDelements
If TDelement.Width = "198" Then
Sheet1.Range("H2").Offset(r, 0).Value = Trim(TDelement.innerText)
r = r + 1
End If
Next
For Each cell In Range("H:H")
If Left(cell, 1) = "R" Then
cell.Value = Right(cell, Len(cell.Value) - 16)
End If
Next