Forum Discussion
Having partial text in a cell change to bold.
The following will on;y work in the desktop version of Excel for Windows or Mac.
Press Alt+F11 to activate the Visual Basic Editor.
Select Insert > Module.
Copy the following code into the new module:
Sub BoldAfterMM()
Dim c As Range
Dim p As Long
Application.ScreenUpdating = False
For Each c In Range(Cell1:=Range("A2"), Cell2:=Range("A2").End(xlDown))
p = InStr(c.Value, "MM")
If p > 0 Then
c.Characters(Start:=p + 2, Length:=1000).Font.Bold = True
End If
Next c
Application.ScreenUpdating = True
End Sub
With the insertion point anywhere in the code, press F5 to execute it.
Switch back to Excel.
If you want to be able to run the macro again later on, save the workbook as a macro-enabled workbook (*.xlsm) and make sure that you allow macros when you open it.
HansVogelaar Thank you for the amazingly quick response. Unfortunately, we use Microsoft 365. I tried it anyway but it didn't work. Again, though....thank you
Scott
- HansVogelaarAug 07, 2024MVP
ScottF1870 If you have any version of Microsoft 365 except for Microsoft 365 Basic, you can use the desktop version of Excel on Mac and Windows. If you do not have that yet, you can install the local apps by logging in to https://www.office.com with your Microsoft 365 account and clicking the Install link.
The macro should work - I tested it using Excel in Microsoft 365 for Windows.