ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Font Colour (https://www.excelbanter.com/excel-programming/372033-using-font-colour.html)

Kevin

Using Font Colour
 
Hi,

If i have a list in column A. Some have black fonts and others have blue
fonts. How can I have the cell next to the black font in column B to say
'true' and the cell next to the blue font to say 'false'

Cheers

Kevin

titus

Using Font Colour
 

Kevin wrote:
Hi,

If i have a list in column A. Some have black fonts and others have blue
fonts. How can I have the cell next to the black font in column B to say
'true' and the cell next to the blue font to say 'false'

Cheers

Kevin


Put your data in column A and select it and put this code in the vba
editor under module

Sub trueorfalse()
Dim cell As Range

For Each cell In Selection
If cell.Font.ColorIndex = 5 Then
Cells(cell, 2) = "False"
Else
Cells(cell, 2) = "True"
End If
Next cell

End Sub

Cheers
titus


Kevin

Using Font Colour
 


"titus" wrote:


Kevin wrote:
Hi,

If i have a list in column A. Some have black fonts and others have blue
fonts. How can I have the cell next to the black font in column B to say
'true' and the cell next to the blue font to say 'false'

Cheers

Kevin


Put your data in column A and select it and put this code in the vba
editor under module

Sub trueorfalse()
Dim cell As Range

For Each cell In Selection
If cell.Font.ColorIndex = 5 Then
Cells(cell, 2) = "False"
Else
Cells(cell, 2) = "True"
End If
Next cell

End Sub

Cheers
titus

Hi titus,


I have tried this but it does not seem to work. Please could you give me
step by step instructions.

Cheers



All times are GMT +1. The time now is 09:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com