LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 cell references - 32 refs - no more highlighting? TimK Excel Discussion (Misc queries) 4 June 30th 09 08:16 PM
Looking Up Part Cell Contents Steve Excel Discussion (Misc queries) 2 April 22nd 09 05:20 PM
Highlighting part of a cell contents in Excel 2003 JLGWhiz Excel Programming 3 March 1st 08 05:12 AM
Further help on cell highlighting if change to contents Francois via OfficeKB.com Excel Programming 2 June 20th 07 01:48 PM
Finding MAX Value of Part of Cell Contents Corey Excel Programming 2 January 12th 07 03:42 AM


All times are GMT +1. The time now is 10:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"