Regarding superscript and subscript

izzy1

New Member
Joined
May 27, 2011
Messages
1
Regarding superscript and subscript
I have recently downloaded chemistry Add-In Formater for excel.
here Is my problem;
for exapmle in cell D5 I type H3PO4 and cell D6 H2PO4- and use chemistry Add-In Formater it affects both cells.
But the problem is that when I write in cell E5 = D6 the formater doesnt affect this cell. Any help?
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
You need to apply the formatting to cell E5 too, format painter should do the job
 
Upvote 0
I downloaded an add-in from Dr. Christopher King at Troy University, which I assume that what you're using. Skimming the source files it appears that it works on text and not formulas hence the the problem. You'll either have to copy and 'paste as values' or use the format painter as suggest by jdmc45.
 
Upvote 0
Izzy1, in response to your PM I think that you won't be able to use the format painter, anyone correct me if I am wrong, as the format painter doesn't work on sub formatting within a cell.

I've tested the format painter and couldn't it get to match a sub format even when it was just text in each cell. Thinking about it more I not sure you can do partial cell formatting with formulas at all or if you can it is beyond my knowledge.

I will look into more though.
 
Last edited:
Upvote 0
They won't carry across. Maybe this (subscripts only, I don't do isotopes :))

Code:
Sub CharFmt()
Dim tRow As Integer, bRow As Integer, fCol As Integer, lCol As Integer
Dim irow As Integer, icol As Integer, iChr As Integer, Title As String
    If Selection.Areas.Count > 1 Then
        MsgBox ("Only one area may be selected")
        Exit Sub
    End If
    Application.ScreenUpdating = False
    tRow = Selection.Row
    bRow = tRow + Selection.Rows.Count - 1
    fCol = Selection.Column
    lCol = fCol + Selection.Columns.Count - 1
    For icol = fCol To lCol
        For irow = tRow To bRow
            Title = ActiveSheet.Cells(irow, icol).Value
            For iChr = 1 To Len(Title)
                If Val(Mid(Title, iChr, 1)) <> 0 Then _
                    ActiveSheet.Cells(irow, icol).Characters(Start:=iChr, Length:=1).Font.Subscript = True
            Next iChr
        Next irow
    Next icol
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,508
Messages
6,179,188
Members
452,893
Latest member
denay

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top