ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find Character & Highlight Cell (https://www.excelbanter.com/excel-programming/341574-find-character-highlight-cell.html)

J-Money

Find Character & Highlight Cell
 
I'm trying to hightlight cells that have the asterisk (*) symbol in
them. I have tried a couple things, but it is not coming to fruition.
Can somebody please look at my code below and let me know what I am
missing or suggest a better method at getting to the end result?

------------------------------------------
Dim c As Range
Dim rng As Range

For Each c In Sheets("Sheet1").Range(Cells(1, "A"),
Cells(Rows.Count, "K").End(xlUp))
If c = Sheets("Sheet1").Range("F2") Then
Set rng = Sheets("Sheet1").Range(Cells(c.Row, "A"),
Cells(c.Row, "K"))
With rng.Interior
.ColorIndex = 16
.Pattern = xlSolid
End With
End If
Next c
-------------------------------------------

Thank you,

J


Tom Ogilvy

Find Character & Highlight Cell
 
If c.Text = Sheets("Sheet1").Range("F2").Text

If you are using the Find command either manually or in code, use ~*
instead of just *

--
Regards,
Tom Ogilvy

"J-Money" wrote in message
ups.com...
I'm trying to hightlight cells that have the asterisk (*) symbol in
them. I have tried a couple things, but it is not coming to fruition.
Can somebody please look at my code below and let me know what I am
missing or suggest a better method at getting to the end result?

------------------------------------------
Dim c As Range
Dim rng As Range

For Each c In Sheets("Sheet1").Range(Cells(1, "A"),
Cells(Rows.Count, "K").End(xlUp))
If c = Sheets("Sheet1").Range("F2") Then
Set rng = Sheets("Sheet1").Range(Cells(c.Row, "A"),
Cells(c.Row, "K"))
With rng.Interior
.ColorIndex = 16
.Pattern = xlSolid
End With
End If
Next c
-------------------------------------------

Thank you,

J





All times are GMT +1. The time now is 05:20 PM.

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