?
Solved

How to format the first character of a string in an Excel 2010 cell

Posted on 2014-11-24
13
Medium Priority
?
111 Views
Last Modified: 2014-11-24
I would like to change the font color of the first character in a string within a cell.  Can this be done?
0
Comment
Question by:tballin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 2
13 Comments
 
LVL 40

Expert Comment

by:als315
ID: 40462275
You should have no problems if you will do it manually. How do you like to accomplish this?
0
 

Author Comment

by:tballin
ID: 40462297
I would like to setup a formatting rule - there's just too many cells to do this manually.
0
 
LVL 40

Expert Comment

by:als315
ID: 40462311
You can't do it with formatting rule, because in these rules you can change colors only in whole cell, but you can do it with macro. Is it acceptable?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tballin
ID: 40462350
A macro will work.
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40462412
Sub HighLightCell()

    Range("A1").Characters(1, 1).Font.Color = vbRed

End Sub
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40462414
Or
Sub HighLightCell()

    Range("A1").Characters(1, 1).Font.Bold = True 'etc.

End Sub
0
 

Author Comment

by:tballin
ID: 40462468
When I run this, the entire cell takes on the new format, not just the first character.
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40462479
Did you copy it correctly? This is what I see.
?
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40462491
Or the following where I did Range("A1").Characters(1, 1).Font.Size = 24.
??
0
 

Author Comment

by:tballin
ID: 40462621
I might be copying it wrong... but here's what I'm seeing:

code.JPGsheet.JPG
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40462640
Hmmm. It seems that it does that for numbers. Let me see what I can do.
0
 
LVL 49

Accepted Solution

by:
Martin Liss earned 2000 total points
ID: 40462682
Sorry but if it's a number (even formatted as text) I don't think it can be done.
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40462838
This does it
Sub HighLightCell()

    Range("A2").Value = "'" & Range("A2").Value
    Range("A2").Characters(1, 1).Font.Color = vbRed
    Range("A2").HorizontalAlignment = xlRight
    
End Sub

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question