Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Format Part of Text Cell using VBA

I have now managed to find a solution:-

Sub EditFont()
'To format font color for 12 digits to 4 black, 5 red, 3 black:
123456789012
'First, format digits to be treated as characters
ActiveCell.Value = "'" & ActiveCell.Value
'Format all characters for black
With ActiveCell
..Font.ColorIndex = 3
'Format characters 5 thru 12 as red
..Characters(1, ActiveCell.Characters.Count - 8).Font.ColorIndex = 1
'Reformat characters 10 thru 12 back to black
..Characters(10, ActiveCell.Characters.Count - 3).Font.ColorIndex = 1
End With

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
How do I format part of a text cell, but not the whole thing? Nicole Excel Discussion (Misc queries) 2 July 4th 08 12:40 AM
format color of text in part of a cell b4nature Excel Discussion (Misc queries) 3 January 4th 07 05:09 PM
Text as part of Cell Format evan Excel Discussion (Misc queries) 1 November 3rd 06 05:48 PM
format part of text in a cell? Yawrood Excel Discussion (Misc queries) 8 June 2nd 06 12:58 AM
How do I format text that is part of a formula? TJ Excel Discussion (Misc queries) 5 December 29th 05 07:54 PM


All times are GMT +1. The time now is 12:35 PM.

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

About Us

"It's about Microsoft Excel"