I am trying to scan through column "A" and apply the bold font to all cells which start with three spaces and then continue with any other characters. If a cell string starts with four space characters, or more; the bold font should not be applied to it.
This is what I have up to now; which causes all the cells of column A to become bold.
Sub Macro1()
Dim regEx As New RegExp
NumRows = Range("A2", Range("A2").End(xlDown)).Rows.Count
regEx.Pattern = "(\s{3})(\S)"
regEx.Global = False
Sheets("1022_CPU").Activate
Range("A2").Activate
Application.ScreenUpdating = False
Do Until IsEmpty(ActiveCell)
If regEx.Test(ActiveCell.Value) Then
ActiveCell.Font.Bold = True
Else
ActiveCell.Font.Bold = False
End If
ActiveCell.Offset(1, 0).Activate
Loop
Range("A1").Select
Application.ScreenUpdating = True
End Sub
EDIT : Sample Data:
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process()
org.apache.coyote.http11.Http11Processor.process()
org.apache.catalina.connector.CoyoteAdapter.service()
org.apache.catalina.core.StandardEngineValve.invoke()
Taking into consideration the above data I would like to apply bold font on the first line (three spaces in front of "org." but not on the other three lines. This is why build in functions such as the "LEFT" function will not work; as it will apply the bold font on all lines.