ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   excel chemisty (https://www.excelbanter.com/excel-discussion-misc-queries/16112-excel-chemisty.html)

kmleague

excel chemisty
 
When I put a chemistry formula into excel, I have to manually go through and
change almost every single number into a subscript through font modification.
Is there an easier way to do this?

Jason Morin

While still tedious, John Walkenbach has a utility that
quickens the process somewhat:

http://j-walk.com/ss/excel/files/supersub.htm

HTH
Jason
Atlanta, GA

-----Original Message-----
When I put a chemistry formula into excel, I have to

manually go through and
change almost every single number into a subscript

through font modification.
Is there an easier way to do this?
.


Bernie Deitrick

kmleague,

Select the cell with the formula, and run the macro below. Assumes that
every number need to be subscripted.

HTH,
Bernie
MS Excel MVP

Sub ApplySubScripts()
Dim i As Integer
Dim j As Integer

On Error GoTo ErrHandler
For i = 1 To Len(ActiveCell.Value)
j = CInt(Mid(ActiveCell.Value, i, 1))
ActiveCell.Characters(Start:=i, Length:=1).Font.Subscript = True
NotNumb:
Next i
Exit Sub

ErrHandler:
Resume NotNumb

End Sub


"kmleague" wrote in message
...
When I put a chemistry formula into excel, I have to manually go through

and
change almost every single number into a subscript through font

modification.
Is there an easier way to do this?




RagDyeR

This should be *exactly* what you're looking for.


http://spectrum.troyst.edu/~cking/ChemFormat/index.html
--

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================

"kmleague" wrote in message
...
When I put a chemistry formula into excel, I have to manually go through and
change almost every single number into a subscript through font
modification.
Is there an easier way to do this?




All times are GMT +1. The time now is 03:51 AM.

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