Dave_O
New Member
- Joined
- Dec 3, 2019
- Messages
- 8
- Office Version
- 2016
- Platform
- Windows
Hello,
I am saving a website's source code as a text file, then importing it into a worksheet.
I currently use a UDF to vbCrLf existing Uppercase word's,
but I would like to make all words Uppercase between <strong> .....<\/strong>
I am OK with either VBA or UDF.
SAMPLE:
As is:
<strong>Balaabel (2) <\/strong>
To be:
<strong>BALAABEL (2) <\/strong>
**************************************************
**************************************************
Screenshot attached.
Thank you.
I am saving a website's source code as a text file, then importing it into a worksheet.
I currently use a UDF to vbCrLf existing Uppercase word's,
but I would like to make all words Uppercase between <strong> .....<\/strong>
I am OK with either VBA or UDF.
SAMPLE:
As is:
<strong>Balaabel (2) <\/strong>
To be:
<strong>BALAABEL (2) <\/strong>
**************************************************
VBA Code:
Function upperCaseWords(S As String) As String
Dim RE As Object
Set RE = CreateObject("vbscript.regexp")
With RE
.Global = True
.MultiLine = True
.Pattern = "^|\s(\b[^a-z0-9]+\b\s*\()"
upperCaseWords = .Replace(S, vbCrLf & "$1")
End With
End Function
Screenshot attached.
Thank you.