Subscript & Superscript

K

Karen

Is it possible to add a subscript & superscript icon to
the tool bars? I cannot find it under the "Customize"
menu.

HELP
 
G

Guest

I think you're going to need to creaet a couple of custom buttons and macros.
In your 'Personal.xls' workbook, insert a module.
TOOLS / MACRO / VISUAL BASIC EDITOR
then
** Highlight 'Personal.xls'
then
INSERT / MODULE

In that module, copy the following code...

'/============================/
Public Sub MySubscript()
With Selection.Font
.Superscript = False
.Subscript = True
End With
End Sub
'/============================/
Public Sub MySuperscript()
With Selection.Font
.Superscript = True
.Subscript = False
End With
End Sub
'/============================/

Now, put 2 buttons on your 'Formatting' toolbar (or whereever).
Right-click in the toolbar area and select 'Customize'.
Under 'Categories', scroll down to 'Macros'. In the 'Commands' window,
left-click on the smiley face and drag it up to whereever in the toolbar area
you want.
Right-click on the button. In the Name box, put SUPERSCRIPT.
Left-click on 'Assign Macro' and select 'MySuperscript' then select 'OK'.
Select 'Close'.
Repeat for the SUBSCRIPT macro.


- - - - - - - - - - - - - - - - - - - - -
**Note: If you don't see 'Personal.xls', go back to your workbook.
TOOLS / MACRO / RECORD NEW MACRO
In the 'Store Macro In' dropdown box, select 'Personal Macro Workbook'.
Select 'OK'. The Macro button should appear. Now move the cursor and click
on the macro button to stop the macro recording.
What this has done is simply to create 'Personal.xls'.
By the way, next time you record a new macro, remember to change back from
'personal Macro Workbook' to 'This Workbook'.
- - - - - - - - - - - - - - - - - - - - -

Hope this helped.
Gary Brown
 
G

Gord Dibben

Karen

No.

You could assign a macro to a button.

Sub Sup_Scr()
With Selection.Font
.Superscript = True
.Subscript = False
End With
End Sub

Note: won't run in Edit mode so can be used for whole cells only.

For a great add-in download John Walkenbach's Supersub

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


Gord Dibben Excel MVP
 
K

Karen

Sorry, I'm familiar with creating macros and module -
Although, what do you mean by 'personal.xls'?
 
G

Guest

Per John Walkenbach...
"This is a workbook (Personal.xls) that is stored in your XlStart directory.
Whenever you start Excel, this workbook is loaded. It's a hidden workbook,
so it's out of your way. When you record a macro, one of your options is to
record it to your Personal Macro Workbook. The Personal.xls file doesn't
exist until you record a macro to it."

Hope this helps,
Gary Brown
 
K

Karen

I fine with every instruction, I just can't find
the'Personal.xls' to highlight when I'm in the Visual
Basic Editor - HELP
 
G

Gord Dibben

Karen

Personal.xls is created the first time you record a Macro using Macro
Recorder.

Tools>Macro>Record New Macro. A dialog box will come up asking you name the
macro and where to place it. Pick Personal Macro Workbook from the dropdown.
Copy and paste a couple of cells then Stop Recording.

You now have a Personal.xls in your Office\XLSTART folder. You can go to
Visual Basic Editor(Alt+F11) to view the macro you just recorded in a Module.

You can add more macros by recording or by typing/copying them into the
Module.

You can do a File>Save from there or better yet hit ALT + Q to return to the
Excel window.

Then with Personal.xls active, hit Window>Hide.

When you close Excel you will be asked if you want to save Personal.xls. Yes!

It will open hidden next time you start Excel.

NOTE: when assigning macros to buttons or menu items you will have to precede
the macro name with Personal.xls.

i.e. Personal.xls!macroname

An alternative to Personal.xls is to create an add-in(*.xla) with your macros
in it and load it through Tools>Add-ins.

The benefit of this is that you don't have to precede the macro name with the
filename.

A disadvantage is that you will not see the macros in the Tools>Macro>Macros
dialog.


Gord Dibben Excel MVP
 

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