Change only bullet font color
-
- SilverLounger
- Posts: 1868
- Joined: 25 Jan 2010, 14:00
- Location: Conroe, Texas
Change only bullet font color
I need a little assistance. I sometimes add a billet at the start of a sentence and I was trying to use conditional formatting so that ONLY the billet font would turn red when ever used for either each sheet or entire workbook. Any suggestions greatly appreciated. I know how to select the billet and change the color manually; I was just trying to find an automatic way
Last edited by HansV on 22 Oct 2016, 13:21, edited 1 time in total.
Reason: to edit the subject (billet > bullet)
Reason: to edit the subject (billet > bullet)
-
- Administrator
- Posts: 78549
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- Administrator
- Posts: 78549
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Change only billet font color
If you mean bullet: conditional formatting applies to a cell as a whole, not to individual characters in a cell.
It might be possible to use VBA code to format bullets, but that might not be desirable: VBA code tends to disable Excel's undo feature.
It might be possible to use VBA code to format bullets, but that might not be desirable: VBA code tends to disable Excel's undo feature.
Best wishes,
Hans
Hans
-
- SilverLounger
- Posts: 1868
- Joined: 25 Jan 2010, 14:00
- Location: Conroe, Texas
Re: Change only billet font color
Sorry, yes I meant bulletHansV wrote:Do you mean bullet?
-
- SilverLounger
- Posts: 1868
- Joined: 25 Jan 2010, 14:00
- Location: Conroe, Texas
Re: Change only billet font color
Thank youHansV wrote:If you mean bullet: conditional formatting applies to a cell as a whole, not to individual characters in a cell.
It might be possible to use VBA code to format bullets, but that might not be desirable: VBA code tends to disable Excel's undo feature.
-
- Administrator
- Posts: 78549
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Change only billet font color
Also, the code would only work for cells in which you enter a value, not for cells with a formula.
Would you like to have the VBA code, or will you work it our yourself?
Would you like to have the VBA code, or will you work it our yourself?
Best wishes,
Hans
Hans
-
- SilverLounger
- Posts: 1868
- Joined: 25 Jan 2010, 14:00
- Location: Conroe, Texas
Re: Change only billet font color
Yes coding sounds good as I do not use formula's, only VBA and conditional formattingHansV wrote:Also, the code would only work for cells in which you enter a value, not for cells with a formula.
Would you like to have the VBA code, or will you work it our yourself?
-
- Administrator
- Posts: 78549
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Change only bullet font color
For one sheet:
Right-click the sheet tab.
Select View Code from the context menu.
Copy the following code into the worksheet module:
Remarks:
1) If you already have code in the Worksheet_Change event procedure, you must add the above code (except for the Private Sub and End Sub lines) to the existing event procedure, preferably at the beginning. It is not allowed to have multiple Worksheet_Change event procedures for the same worksheet.
2) If the worksheet is protected, you must unprotect it at the beginning of the code, and reprotect it at the end.
For the entire workbook:
Activate the Visual Basic Editor.
Double-click ThisWorkbook.
Copy the following code into the ThisWorkbook module:
The same remarks as above apply.
Right-click the sheet tab.
Select View Code from the context menu.
Copy the following code into the worksheet module:
Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cel As Range
Application.ScreenUpdating = False
Application.EnableEvents = False
For Each cel In Target
If Left(cel.Value, 1) = Chr(149) And Not cel.HasFormula Then
cel.Characters(1, 1).Font.Color = vbRed
End If
Next cel
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
1) If you already have code in the Worksheet_Change event procedure, you must add the above code (except for the Private Sub and End Sub lines) to the existing event procedure, preferably at the beginning. It is not allowed to have multiple Worksheet_Change event procedures for the same worksheet.
2) If the worksheet is protected, you must unprotect it at the beginning of the code, and reprotect it at the end.
Activate the Visual Basic Editor.
Double-click ThisWorkbook.
Copy the following code into the ThisWorkbook module:
Code: Select all
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim cel As Range
Application.ScreenUpdating = False
Application.EnableEvents = False
For Each cel In Target
If Left(cel.Value, 1) = Chr(149) And Not cel.HasFormula Then
cel.Characters(1, 1).Font.Color = vbRed
End If
Next cel
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Best wishes,
Hans
Hans
-
- SilverLounger
- Posts: 1868
- Joined: 25 Jan 2010, 14:00
- Location: Conroe, Texas
Re: Change only bullet font color
Your awesome, thanks Hans