Home |
Search |
Today's Posts |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes. The line of code that I was missing was:
q.font.colorindex = 3 I know it sounds like a strange request. However, that's what the client wants. To be able to loop through all the values in a given range, change the font to red, then print out the same range over and over again. Thanks to all for the insights and suggestions. I learned a lot. C -- Craig "William" wrote: Have you thought about using conditional formatting rather than looping through the cells.... Sub test() On Error Resume Next With ActiveSheet With .Range("Print_Area") 'if the print range has not been set 'use a range such as C1:R100 .FormatConditions.Delete With .SpecialCells(xlCellTypeConstants, 1) .FormatConditions.Add Type:=xlCellValue, _ Operator:=xlNotEqual, Formula1:=0 .FormatConditions(1).Font.ColorIndex = 3 End With With .SpecialCells(xlCellTypeFormulas, 1) .FormatConditions.Add Type:=xlCellValue, _ Operator:=xlNotEqual, Formula1:=0 .FormatConditions(1).Font.ColorIndex = 3 End With End With .Printout .Range("Print_Area").FormatConditions.Delete End With End Sub Alternatively, you could play with the number formatting... Sub test1() With ActiveSheet ..Range("Print_Area").NumberFormat = "[Red][0]#,##0;[Red][<0]#,##0" ..PrintOut ..Range("Print_Area").NumberFormat = "#,##0_ ;[Red](#,##0)" End With End Sub -- XL2003 Regards William "Craig" wrote in message ... I'm using Excel 2000. I have a range that I'm iterating through (For Each x in Range...). If there is a number in the range, then I would like to change certain characteristics of that particular cell (font, color, etc.) and then have some other actions take place. Is there a way to reference a particular cell this way (the only way I can think of is to NOT use the For Each method, and instead, literally select each cell in the range and use the Activecell.Offset method to advance to the next cell, etc. I'd prefer to not have to do it this way, though. Any ideas? Thanks for any and all help. -- Craig |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I enter formula sum(range+range)*0.15 sumif(range=3) | Excel Discussion (Misc queries) | |||
Excel Addin:Setting the range to the Excel.Range object range prop | Excel Worksheet Functions | |||
Range Question / error 1004: method Range of object Worksheet has failed | Excel Programming | |||
Range.Find returns cell outside of range when range set to single cell | Excel Programming | |||
how to? set my range= my UDF argument (range vs. value in range) [advanced?] | Excel Programming |