Sharid
Well-known Member
- Joined
- Apr 22, 2007
- Messages
- 1,064
- Office Version
- 2016
- Platform
- Windows
I am trying to trim some text from some html, but can not work it out. I have never been good at triming as I don't full understand it. The text will always be between the first two forward slashes "/" in this case the text is "webdevlondon".
The data (Html) will go into the column B as it is FOUND and then I want to clean it up with a trim only leaving the name. It is currently not in the column, therefore the procedure has to be called after the data as gone into a cell in column b
OuterHTML
I was tying to use this, data will be in row 2 and dynamic lenght. If possible I would like it done with vba and it seems to run faster I have tried TRIM process in the past and they seem to be much slower.
The data (Html) will go into the column B as it is FOUND and then I want to clean it up with a trim only leaving the name. It is currently not in the column, therefore the procedure has to be called after the data as gone into a cell in column b
OuterHTML
HTML:
<A class=_2yau href="about:/webdevlondon/?ref=page_internal" data-endpoint="/webdevlondon/?ref=page_internal"><SPAN class=_2yav>Home</SPAN><SPAN role=progressbar aria-busy=true aria-valuetext=Loading... class="img _55ym _55yn _55yo _2wwb" aria-valuemin=0 aria-valuemax=100></SPAN></A>
I was tying to use this, data will be in row 2 and dynamic lenght. If possible I would like it done with vba and it seems to run faster I have tried TRIM process in the past and they seem to be much slower.
VBA Code:
Set wb = ThisWorkbook
Set wsSheet = wb.Sheets("Data")
wsSheet.Columns(b).Value = Left(myString, InStr(2, myString, "/", vbTextCompare) - 1) ' trim items on right
wsSheet.Columns(b).Value = Right(myString, InStr(2, myString, "/", vbTextCompare) - 1) ' trim items on left