View Full Version : Is it possible to write vba code to create a conditional format on cells?
Hi, everyone! I will like to know how to write vba code to firstly, identify various cells for example that have 42, and color those cells with the color red. I would like to be able to use a macro or vba code to this. Can this be done? If so, how can this be done? Do you have any samples?
Thanks for your contributions:friends:
Is there a reason you wouldn't just use CV?
mdmackillop
01-31-2011, 03:20 PM
I would use CV, but for a simple macro try
Sub Macro1()
Application.ReplaceFormat.Interior.ColorIndex = 3
Cells.Replace What:="42", Replacement:="42", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=True
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.