I created the following REGEX to markup an Excel file with certain scripting tags (^Joe Bloggs+JoeBloggs^).
However, the problem is that I am not knowledgeable enough to change the VBA script below so that the user can specify which particular Excel column to parse.
At the moment, the code below is restricted to running on Column A:A only, and I would like to be able to run it for Column D:D, or as per the user input.
Sub RegExp_1()
Dim objRegex
Dim RegMC
Dim RegM
Set objRegex = CreateObject("vbscript.regexp")
With CreateObject("VBScript.RegExp")
.MultiLine = True
.Global = True
.IgnoreCase = True
.Pattern = "\^[\w\W\s]*\^|<[\W]{2,3}\^[\w\W\s]*\^[\W]{1,3}\>"
For i = 1 To 10000
If .test(Cells(i, 1).Value) Then
Set RegMC = .Execute(Cells(i, 1).Value)
For Each RegM In RegMC
Cells(i, 1).Characters(RegM.firstindex, RegM.Length + 1).Font.FontStyle = "Bold"
Cells(i, 1).Characters(RegM.firstindex, RegM.Length + 1).Font.Size = 12
Cells(i, 1).Characters(RegM.firstindex, RegM.Length + 1).Font.ColorIndex = 5
Next
End If
Next i
End With
Call RegExp_2
Call RegExp_3
Call RegExp_4
MsgBox "Scripting tags have now been marked-up!"
End Sub
Thanks.