Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
How to restore superscript or subscript format of text while using functions
like concatenate etc |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Formulas don't support this kind of character by character formatting.
yshridhar wrote: How to restore superscript or subscript format of text while using functions like concatenate etc -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You can't - functions return values, not formatting.
You'd have to use an event macro instead. For instance, say your formula was F3: =A1 & " " & J1 Then you could put something like this in your worksheet code module (right-click the worksheet tab and choose View Code): Private Sub Worksheet_Change(ByVal Target As Excel.Range) Dim rCell1 As Range Dim rCell2 As Range Dim i As Long Dim j As Long If Not Intersect(Target, Range("A1,J1")) Is Nothing Then Set rCell1 = Range("A1") Set rCell2 = Range("J1") With Range("F3") .Clear .Value = rCell1.Text & " " & rCell2.Text For i = 1 To Len(rCell1.Text) With .Characters(i, 1).Font .Superscript = rCell1.Characters(i, 1).Font.Superscript .Subscript = rCell1.Characters(i, 1).Font.Subscript End With Next i For j = 1 To Len(rCell2.Text) With .Characters(j + i, 1).Font .Superscript = rCell2.Characters(j, 1).Font.Superscript .Subscript = rCell2.Characters(j, 1).Font.Subscript End With Next j End With End If End Sub In article , yshridhar wrote: How to restore superscript or subscript format of text while using functions like concatenate etc |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thank you Mr. McGimpsey
Can this be extended say i would like to use this macro to concatenate column A and column J in column F with many thanks Sridhar "JE McGimpsey" wrote: You can't - functions return values, not formatting. You'd have to use an event macro instead. For instance, say your formula was F3: =A1 & " " & J1 Then you could put something like this in your worksheet code module (right-click the worksheet tab and choose View Code): Private Sub Worksheet_Change(ByVal Target As Excel.Range) Dim rCell1 As Range Dim rCell2 As Range Dim i As Long Dim j As Long If Not Intersect(Target, Range("A1,J1")) Is Nothing Then Set rCell1 = Range("A1") Set rCell2 = Range("J1") With Range("F3") .Clear .Value = rCell1.Text & " " & rCell2.Text For i = 1 To Len(rCell1.Text) With .Characters(i, 1).Font .Superscript = rCell1.Characters(i, 1).Font.Superscript .Subscript = rCell1.Characters(i, 1).Font.Subscript End With Next i For j = 1 To Len(rCell2.Text) With .Characters(j + i, 1).Font .Superscript = rCell2.Characters(j, 1).Font.Superscript .Subscript = rCell2.Characters(j, 1).Font.Subscript End With Next j End With End If End Sub In article , yshridhar wrote: How to restore superscript or subscript format of text while using functions like concatenate etc |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I format Concatenate function? | Excel Discussion (Misc queries) | |||
Cannot format data after using mid() function | Excel Worksheet Functions | |||
Function to format cells??? | Excel Worksheet Functions | |||
the function FORMAT() | Excel Discussion (Misc queries) | |||
Problem with function format | Excel Worksheet Functions |