chacanger
02-16-2011, 12:37 PM
Hi
I've recently been trying to split text into what text I need and what text I don't need through VBA to automate it. The text I receive comes from a web page so the text usually looks something like this...
Mr Chacanger</p><ul class="sp_pss"><li>29 replies in thread</li></ul><div>
But sometimes may look like... :thinking:
Mr Fake Person</p><ul class="sp_pss">
So as you can see the text can change in terms of spaces, words and characters. When I do Text to columns I use separate by "<", but as I want only the Name part when I run the code it keeps the unwanted data e.g. </p><ul class="sp_pss">[/B] in columns next to it which is overwriting data in the columns next to it.
Does anyone know how to get around this? Also here is a sample of Code that does it to the active cell...
Sub TTC()
Selection.TextToColumns _
Destination:=ActiveCell, _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
Other:=True, OtherChar:="<"
End Sub
Thanks
I've recently been trying to split text into what text I need and what text I don't need through VBA to automate it. The text I receive comes from a web page so the text usually looks something like this...
Mr Chacanger</p><ul class="sp_pss"><li>29 replies in thread</li></ul><div>
But sometimes may look like... :thinking:
Mr Fake Person</p><ul class="sp_pss">
So as you can see the text can change in terms of spaces, words and characters. When I do Text to columns I use separate by "<", but as I want only the Name part when I run the code it keeps the unwanted data e.g. </p><ul class="sp_pss">[/B] in columns next to it which is overwriting data in the columns next to it.
Does anyone know how to get around this? Also here is a sample of Code that does it to the active cell...
Sub TTC()
Selection.TextToColumns _
Destination:=ActiveCell, _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
Other:=True, OtherChar:="<"
End Sub
Thanks