Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi guys,
I need VBA code to add to an existing macro. If column H has an "x" in it then I need that entire row highlighed as color 42 (light blue). Below is what I tried but it isn't working. Any help would be appreciated. Dim cfrange As range Set cfrange = range("h7:h700") If cfrange = "x" Then range("A:G").Interior.ColorIndex = 42 End If -- Danielle :<) |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
for each c in range("h7:h700")
if ucase(c)="X" then rows(c.row).interior.colorindex=42 next c -- Don Guillett Microsoft MVP Excel SalesAid Software "DanielleVBANewbie" wrote in message ... Hi guys, I need VBA code to add to an existing macro. If column H has an "x" in it then I need that entire row highlighed as color 42 (light blue). Below is what I tried but it isn't working. Any help would be appreciated. Dim cfrange As range Set cfrange = range("h7:h700") If cfrange = "x" Then range("A:G").Interior.ColorIndex = 42 End If -- Danielle :<) |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
that did it, thank you so much.
-- Danielle :<) "Don Guillett" wrote: for each c in range("h7:h700") if ucase(c)="X" then rows(c.row).interior.colorindex=42 next c -- Don Guillett Microsoft MVP Excel SalesAid Software "DanielleVBANewbie" wrote in message ... Hi guys, I need VBA code to add to an existing macro. If column H has an "x" in it then I need that entire row highlighed as color 42 (light blue). Below is what I tried but it isn't working. Any help would be appreciated. Dim cfrange As range Set cfrange = range("h7:h700") If cfrange = "x" Then range("A:G").Interior.ColorIndex = 42 End If -- Danielle :<) . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The only excuse I have for the following is.... it's Saturday and things are
slow.<g I decided to investigate whether this problem could be solved without using a loop and I came up with what follows. Strange thing is that a **quick** test shows the following code to be equal, or perhaps possibly faster, than the loop you posted. If anyone has a **high resolution** timer and the time/inclination to test this out, the results might be interesting. With that said, here is what I came up with... Dim Addr As String, Xcol As Range, Col2Color As Range Set Xcol = Range("H7:H700") 'Range with X's Set Col2Color = Range("A7:G700") 'Range whose cells can be colored Application.ScreenUpdating = False On Error Resume Next Addr = Xcol.SpecialCells(xlCellTypeBlanks).Address Col2Color.Interior.ColorIndex = xlNone Xcol.Replace "X", "", xlWhole, , True Intersect(Col2Color, Xcol.SpecialCells(xlCellTypeBlanks). _ EntireRow).Interior.ColorIndex = 42 Xcol.SpecialCells(xlCellTypeBlanks).Value = "X" Range(Addr).Value = "" Intersect(Col2Color, Range(Addr).EntireRow).Interior.ColorIndex = xlNone Application.ScreenUpdating = True -- Rick (MVP - Excel) "Don Guillett" wrote in message ... for each c in range("h7:h700") if ucase(c)="X" then rows(c.row).interior.colorindex=42 next c -- Don Guillett Microsoft MVP Excel SalesAid Software "DanielleVBANewbie" wrote in message ... Hi guys, I need VBA code to add to an existing macro. If column H has an "x" in it then I need that entire row highlighed as color 42 (light blue). Below is what I tried but it isn't working. Any help would be appreciated. Dim cfrange As range Set cfrange = range("h7:h700") If cfrange = "x" Then range("A:G").Interior.ColorIndex = 42 End If -- Danielle :<) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2003 : conditional format for 5 format settings | Excel Programming | |||
Conditional Format overwrighting previous conditional format | Excel Programming | |||
New Conditional Format Overriding Previous Conditional Format | Excel Discussion (Misc queries) | |||
Multiple conditional on conditional format formula | Excel Programming | |||
Keep format after paste from other worksheets - conditional format or EnableControl solution doesn't work | Excel Programming |