Custom Buttons

G

Guest

I use a lot of subscripts and superscripts in my work and I would like to create a custom button for a toolbar that automatically changes to subscripts and/or superscripts. Does anyone if you can create custom buttons?
 
F

Frank Isaacs

This looks like a tough one. It's easy to do for an entire cell, but I'm
guessing you only sub- and super-script one (or some) of the characters in a
cell, rather than a whole cell. The problem is that if you select characters
in a cell, you cannot then run a macro on them; those options are
unavailable on the menu (as are most buttons on the toolbars).

If you want to do a whole cell, you can attach a macro such as the following
to a custom button:

Sub Super()
ActiveCell.Characters.Font.Superscript = True
End Sub

One improvement that could work is if you always want to superscript exactly
1 character (or some known number) - then you could pre-program it, for
example:

Sub Super()
ActiveCell.Characters(ActiveCell.Characters.Count, 1).Font.Superscript =
True
End Sub
--
HTH -

-Frank Isaacs
Dolphin Technology Corp.
http://vbapro.com




Marc D said:
I use a lot of subscripts and superscripts in my work and I would like to
create a custom button for a toolbar that automatically changes to
subscripts and/or superscripts. Does anyone if you can create custom
buttons?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top