Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Highlighting part of a cell contents in Excel 2003
Assuming your numbers are always separated by underscore (underline)
characters, I think this macro will do what you want... Sub ColorCertainNumbers() Dim X As Long Dim Start As Long Dim Cell As Range Dim Nums() As String For Each Cell In Range("A1:A10") Start = 1 Nums = Split(Cell.Value, "_") For X = 0 To UBound(Nums) If Not Nums(X) Like "*[!0-9]*" Then If Nums(X) 32 And Nums(X) < 101 Then Cell.Characters(Start, Len(Nums(X))).Font.Color = vbRed End If End If Start = Start + Len(Nums(X)) + 1 Next Next End Sub By the way, the code, as written, will handle more than two numbers (separated by underscores) per cell. Rick "Gregg" wrote in message ... I have values in cells A1:A10 expressed thusly: A1= 23_47 A2= 37_9 etc.. I would like to write code that will highlight individual numbers in the cells A1:A10 that are greater than 32 and less than 101. In cell A1 "47" would be highlighted, in cell A2 "37" would be highlighted. Red can be the highlight color. Gregg |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2003 cell references - 32 refs - no more highlighting? | Excel Discussion (Misc queries) | |||
Looking Up Part Cell Contents | Excel Discussion (Misc queries) | |||
Highlighting part of a cell contents in Excel 2003 | Excel Programming | |||
Further help on cell highlighting if change to contents | Excel Programming | |||
Finding MAX Value of Part of Cell Contents | Excel Programming |