Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 48
Default Format single character

Hello All,

Using Excel '07...

Is there a way to use conditional formatting (or something else) to
color a single character in a string.

E.g., change the color of the fifth character in a cell?

alex
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default Format single character

Manually color = yes
Conditional formatting color = no

"alex" wrote:

Hello All,

Using Excel '07...

Is there a way to use conditional formatting (or something else) to
color a single character in a string.

E.g., change the color of the fifth character in a cell?

alex

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Format single character

On Thu, 16 Apr 2009 11:49:23 -0700 (PDT), alex wrote:

Hello All,

Using Excel '07...

Is there a way to use conditional formatting (or something else) to
color a single character in a string.

E.g., change the color of the fifth character in a cell?

alex


Only if it is a string, and not the result of a formula.

Select the cell and go into edit mode. Then select the character and format
it.

This could also be done with VBA:

To enter this Macro (Sub), <alt-F11 opens the Visual Basic Editor.
Ensure your project is highlighted in the Project Explorer window.
Then, from the top menu, select Insert/Module and
paste the code below into the window that opens.

To use this Macro (Sub), <alt-F8 opens the macro dialog box. Select the macro
by name, and <RUN.

=========================
Option Explicit
Sub Red5Char()
Dim c As Range
Set c = Selection
If c.Count < 1 Then Exit Sub
If Len(c.Text) < 5 Then Exit Sub
c.Characters(5, 1).Font.Color = vbRed
End Sub
==========================
--ron
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 48
Default Format single character

On Apr 16, 3:59*pm, Ron Rosenfeld wrote:
On Thu, 16 Apr 2009 11:49:23 -0700 (PDT), alex wrote:
Hello All,


Using Excel '07...


Is there a way to use conditional formatting (or something else) to
color a single character in a string.


E.g., change the color of the fifth character in a cell?


alex


Only if it is a string, and not the result of a formula.

Select the cell and go into edit mode. *Then select the character and format
it.

This could also be done with VBA:

To enter this Macro (Sub), <alt-F11 opens the Visual Basic Editor.
Ensure your project is highlighted in the Project Explorer window.
Then, from the top menu, select Insert/Module and
paste the code below into the window that opens.

To use this Macro (Sub), <alt-F8 opens the macro dialog box. Select the macro
by name, and <RUN.

=========================
Option Explicit
Sub Red5Char()
Dim c As Range
Set c = Selection
If c.Count < 1 Then Exit Sub
If Len(c.Text) < 5 Then Exit Sub
c.Characters(5, 1).Font.Color = vbRed
End Sub
==========================
--ron


Thanks for your input, Ron.

This xls doc is a simple calculator that sits on a user's desktop.
The user enters different numbers (8 char long) throughout the day
into the same cell (only one number at a time). I would like the fith
character of any number to become a certain color whenever it's typed.

I'll play around with the VBA code that you provided. I don't want
the user to have to envoke a marcro...

alex
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Format single character

On Fri, 17 Apr 2009 03:30:25 -0700 (PDT), alex wrote:

Thanks for your input, Ron.

This xls doc is a simple calculator that sits on a user's desktop.
The user enters different numbers (8 char long) throughout the day
into the same cell (only one number at a time). I would like the fith
character of any number to become a certain color whenever it's typed.

I'll play around with the VBA code that you provided. I don't want
the user to have to envoke a marcro...

alex


Alex,

I don't think you can do that.

You could certainly use event code to avoid your user having to execute a
macro. However, the formatting will not take place until after the entire
number has been entered into the cell. I don't know how to format the digits
as they are being entered.

--ron
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
find replace excel remove single character AlaskaBoy Excel Discussion (Misc queries) 5 March 31st 08 03:16 PM
LEN fuction to leave a single character Jonah Excel Worksheet Functions 6 March 22nd 06 03:32 PM
how do I make single character as a variable in an array Hazlgrnguy Excel Worksheet Functions 1 September 25th 05 08:12 AM
How can I combine multiple characters into a single character? Yukon Chin Excel Discussion (Misc queries) 4 January 22nd 05 03:29 AM
Test for Single Character That is in an Array scallyte Excel Worksheet Functions 2 November 11th 04 04:47 PM


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