Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default can we color a cell content partly?

Hi,
My question may look like a simple one but here it goes:

combining cell contents via formulas such as
C10=A20&" ("&B40&")"
is simple and straight forward enough.

But can I manage to display cell B40 contents using a different color (say
red) then cell A20 content in C10 programmatically?. In target cell C10
where cells A20 and B40 contents are to be merged I need to see cell A20
contents in default color, but cell B40 contents in red.
An example will be much appreciated.
TIA
J_J


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default can we color a cell content partly?

"J_J" wrote in message
...
Hi,
My question may look like a simple one but here it goes:

combining cell contents via formulas such as
C10=A20&" ("&B40&")"
is simple and straight forward enough.

But can I manage to display cell B40 contents using a different color (say
red) then cell A20 content in C10 programmatically?. In target cell C10
where cells A20 and B40 contents are to be merged I need to see cell A20
contents in default color, but cell B40 contents in red.
An example will be much appreciated.
TIA
J_J


this will change appearance of characters [1..3] and [4..5] in cell.
you just need to take care where starts the characters from each merged
cells

With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.ColorIndex = 1
End With
With ActiveCell.Characters(Start:=4, Length:=2).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.ColorIndex = 3
End With


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default can we color a cell content partly?

Following on from sali's suggestion -

Sub MultiFont()
[a1] = "Normal text"
[b1] = "Red text"

With Range("C1")
..Value = Range("A1") & " (" & Range("B1") & ")"
..Font.ColorIndex = xlAutomatic
..Characters(Len(Range("A1")) + 3, Len(Range("B1"))).Font.ColorIndex = 3
End With

End Sub

This puts only the value in a cell (not formula) and doesn't colour the
brackets, adjust as required. How & when you would implement this would
depend on several other factors.

Regards,
Peter T


"J_J" wrote in message
...
Hi,
My question may look like a simple one but here it goes:

combining cell contents via formulas such as
C10=A20&" ("&B40&")"
is simple and straight forward enough.

But can I manage to display cell B40 contents using a different color (say
red) then cell A20 content in C10 programmatically?. In target cell C10
where cells A20 and B40 contents are to be merged I need to see cell A20
contents in default color, but cell B40 contents in red.
An example will be much appreciated.
TIA
J_J




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default can we color a cell content partly?

Thanks sali and Peter...that was cool.

"Peter T" <peter_t@discussions wrote in message
...
Following on from sali's suggestion -

Sub MultiFont()
[a1] = "Normal text"
[b1] = "Red text"

With Range("C1")
.Value = Range("A1") & " (" & Range("B1") & ")"
.Font.ColorIndex = xlAutomatic
.Characters(Len(Range("A1")) + 3, Len(Range("B1"))).Font.ColorIndex = 3
End With

End Sub

This puts only the value in a cell (not formula) and doesn't colour the
brackets, adjust as required. How & when you would implement this would
depend on several other factors.

Regards,
Peter T


"J_J" wrote in message
...
Hi,
My question may look like a simple one but here it goes:

combining cell contents via formulas such as
C10=A20&" ("&B40&")"
is simple and straight forward enough.

But can I manage to display cell B40 contents using a different color
(say
red) then cell A20 content in C10 programmatically?. In target cell C10
where cells A20 and B40 contents are to be merged I need to see cell A20
contents in default color, but cell B40 contents in red.
An example will be much appreciated.
TIA
J_J






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
Change background color based on cell content from link joemc911 Excel Discussion (Misc queries) 0 April 22nd 10 04:52 PM
Change cell background color based on content that results from li joemc911 Excel Discussion (Misc queries) 4 March 24th 10 02:16 PM
How can I automatically color a row based on cell content Ed Excel Worksheet Functions 1 January 8th 10 01:06 AM
how to change a cell color based on its content using macro? Ranger888 New Users to Excel 6 December 15th 08 08:23 PM
Automated imput partly Matt_07 Excel Worksheet Functions 2 January 30th 07 01:59 PM


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

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"