Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format Cell Background on Condition
Can anyone help me with a VBA routine that will find all cells in a worksheet
that contain the string 'Member Totals' and then shade that cell and the five adjacent cells (to the left) in grey. I would use conditional formatting, but I have lots of merged cells so I can't fill the formatting down. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format Cell Background on Condition
Yet another example of why merged cells should be outlawed...
In article , "PCullen" wrote: I would use conditional formatting, but I have lots of merged cells so I can't fill the formatting down. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format Cell Background on Condition
Sub ColorCells()
Dim c As String Dim rng As Range Dim sAddr As String c = "Member Totals" Cells.Interior.ColorIndex = xlNone Set rng = Cells.Find(what:=c, _ After:=Range("A1"), _ LookIn:=xlValues, _ LookAt:=xlPart, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False) If Not rng Is Nothing Then sAddr = rng.Address Do Set rng1 = rng.MergeArea(1) Set rng1 = rng1.Offset(0, -5).Resize(1, 6) rng1.Interior.ColorIndex = 15 Set rng = Cells.FindNext(rng) Loop Until rng.Address = sAddr End If End Sub -- Regards, Tom Ogilvy "PCullen" wrote in message ... Can anyone help me with a VBA routine that will find all cells in a worksheet that contain the string 'Member Totals' and then shade that cell and the five adjacent cells (to the left) in grey. I would use conditional formatting, but I have lots of merged cells so I can't fill the formatting down. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Condition Format with 2 cell | Excel Worksheet Functions | |||
Cell format as condition | Excel Worksheet Functions | |||
Determining background color of cell, in &H0080FFFF& format? | Excel Programming | |||
Conditional format if cell=0 then font colour same as background . | Excel Discussion (Misc queries) | |||
change background color of row until condition is met | Excel Programming |