ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Locate and change font color (https://www.excelbanter.com/excel-programming/432253-locate-change-font-color.html)

Mobil Dick

Locate and change font color
 
I want to locate a # in a large group of no.s & change their font color

Cell(G2):match same number(E14:N79)change font Pattern (red)
--
Interested in MicroSoft excel 2003, I know just enough to be dangerous,
thats why I am here.

Jacob Skaria

Locate and change font color
 
Hi

Try the below and feedback

--The below macro works on Active workbook Worksheets("Sheet1")..

--Initially it turns the font color of all data in the range
Range("E14:N79") to the default color

--Then search for the entries which match cell G2 and turns the font color
to red..

Sub Macro()
Dim varFound As Variant, varSearch As Variant
Dim strAddress As String

varSearch = Range("G2")
Worksheets("Sheet1").Range("E14:N79").Font.ColorIn dex = 0
With Worksheets("Sheet1").Range("E14:N79")
Set varFound = .Find(varSearch, LookIn:=xlValues)
If Not varFound Is Nothing Then
strAddress = varFound.Address
Do
varFound.Font.ColorIndex = 3
Set varFound = .FindNext(varFound)
Loop While Not varFound Is Nothing And _
varFound.Address < strAddress
End If
End With

End Sub

--
If this post helps click Yes
---------------
Jacob Skaria


"Mobil Dick" wrote:

I want to locate a # in a large group of no.s & change their font color

Cell(G2):match same number(E14:N79)change font Pattern (red)
--
Interested in MicroSoft excel 2003, I know just enough to be dangerous,
thats why I am here.



All times are GMT +1. The time now is 12:29 PM.

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