ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   change font using macro (https://www.excelbanter.com/excel-programming/358121-change-font-using-macro.html)

L Scholes

change font using macro
 
I need to change the font of the last two characters in a cell, but
only for certain cells (make last two superscript and underlined). Does
anybody have any suggestions?


Chip Pearson

change font using macro
 
With Range("A2").Characters(Len(Range("A2").Text) - 1, 2).Font
..Superscript = True
..Underline = True
End With

The problem with this is that the underlining is at the bottom of
the cell, not directly under the superscripted characters. I
don't think there is a workaround for this.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"L Scholes" wrote in message
oups.com...
I need to change the font of the last two characters in a cell,
but
only for certain cells (make last two superscript and
underlined). Does
anybody have any suggestions?




Tom Ogilvy

change font using macro
 
Demo this on a blank worksheet

Sub ShowMe()
With ActiveCell
.Value = "ABCDEFGHIJK"
.Font.Superscript = False
.Font.Underline = False
With .Characters(Len(ActiveCell.Value) - 1, 2)
.Font.Superscript = True
.Font.Underline = True
End With
End With
End Sub


--
Regards,
Tom Ogilvy



"L Scholes" wrote:

I need to change the font of the last two characters in a cell, but
only for certain cells (make last two superscript and underlined). Does
anybody have any suggestions?




All times are GMT +1. The time now is 10:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com