View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
J.E. McGimpsey J.E. McGimpsey is offline
external usenet poster
 
Posts: 493
Default Function: Join Cells with Format

A worksheet function can only return a value - it can't do
formatting. You could instead use an event macro: put this in the
worksheet code module (right-click on the worksheet tab and choose
View Code):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Intersect(Range("A1:C1"), Target) Is Nothing Then
With Range("A1:D1")
Application.EnableEvents = False
.Item(4).Value = .Item(1) & .Item(2) & .Item(3)
.Item(4).Characters(Len(.Item(1)) + 1, _
Len(.Item(2))).Font.Superscript = True
Application.EnableEvents = True
End With
End If
End Sub


In article ,
"Alexey E. Kolmyk" wrote:

Hi,

Could you help me?
How to join cells with different fonts?
For example, I have:
A1 = "2" (Normal)
B1 = "10" (Superscript)
C1 = "=1024" (Normal)
and I want to see 2^10=1024 (where "^10" - is "10" in
superscript). So, can I write:
D1 = SomeFuncJointWithFormats(A1, B1, C1)?

Thank you for help,
Alexey E. Kolmyk