Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Colleen
 
Posts: n/a
Default how to format only a specific character or number in each cell withina range of cells

I am sending this to several Excel newsgroups, because I am not sure
which one if the most appropriate. I apologize in advance for the
multiple postings. I have MS Excel 2000 (version 9.0.3821 SR-1). How
can I format only a selected character or number within each cell in a
specific range of cells? For instance if I have a cell containing
“1234234”, how can I format it so that only the 2’s are bold or are
colored? Obviously, I have a range of cells, and I want to format all
the 2’s occurring in any of the cells as either bold or colored.
Conditional formatting does not seem to allow me to do this, and I have
been unable to find a formula that will accomplish this. Can someone help?
Thank you.
Colleen
  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Colleen,

You can't do this to numbers that are actual numbers, but if you don't mind converting your numbers
to strings, you can select the cells and run the macro below.

HTH,
Bernie
MS Excel MVP

Sub Macro1()
Dim myCell As Range
Dim myStart As Integer
For Each myCell In Selection
myCell.Value = "'" & myCell.Value
myStart = 1
While InStr(myStart, myCell.Value, "2") 0
myStart = InStr(myStart, myCell.Value, "2")
With myCell.Characters(Start:=myStart, Length:=1).Font
.FontStyle = "Bold"
.ColorIndex = 3
End With
myStart = myStart + 1
Wend
Next myCell
End Sub

"Colleen" wrote in message
link.net...
I am sending this to several Excel newsgroups, because I am not sure which one if the most
appropriate. I apologize in advance for the multiple postings. I have MS Excel 2000 (version
9.0.3821 SR-1). How can I format only a selected character or number within each cell in a
specific range of cells? For instance if I have a cell containing “1234234”, how can I format it
so that only the 2’s are bold or are colored? Obviously, I have a range of cells, and I want to
format all the 2’s occurring in any of the cells as either bold or colored. Conditional formatting
does not seem to allow me to do this, and I have been unable to find a formula that will accomplish
this. Can someone help?
Thank you.
Colleen



Reply
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
Number format exactly the same, displays differently in some cells eider Excel Discussion (Misc queries) 1 July 29th 05 12:26 AM
Number format for Combobox MBlake Excel Discussion (Misc queries) 1 June 29th 05 03:25 AM
Count number of times a specific number is displayed in a cell ran subs Excel Worksheet Functions 1 June 27th 05 05:01 PM
Custom number format always defaults last number to 0. scubadave Excel Discussion (Misc queries) 2 June 15th 05 10:20 PM
How do i change numbers in text format to number format? Greg New Users to Excel 1 December 14th 04 05:22 PM


All times are GMT +1. The time now is 07:11 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"