ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How can I find and format specific cells automatically in Excel? (https://www.excelbanter.com/excel-worksheet-functions/39056-how-can-i-find-format-specific-cells-automatically-excel.html)

Amy

How can I find and format specific cells automatically in Excel?
 
I format lengthy spreadsheets frequently and would like to know if it's
possible to find all cells with specific text (say, "Q*") and then format all
of those cells to a specific color and bold font. I'd like to accomplish
this automatically, if possible. Help!

Gary's Student

This is an example. This code looks at the first 10X10 cells for the
occurance of the word "treasure". If the word is found, then the format of
that cell is changed.

You can adapt this for your use.

Sub markit()
Dim t As String
Dim t2 As String
t2 = "treasure"
For i = 1 To 10
For j = 1 To 10
t = Cells(i, j)
If InStr(t, t2) 0 Then
Cells(i, j).Select
With Selection.Font
.FontStyle = "Bold"
.ColorIndex = 6
End With
End If
Next j
Next i
End Sub
--
Gary's Student


"Amy" wrote:

I format lengthy spreadsheets frequently and would like to know if it's
possible to find all cells with specific text (say, "Q*") and then format all
of those cells to a specific color and bold font. I'd like to accomplish
this automatically, if possible. Help!



All times are GMT +1. The time now is 03:10 AM.

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