How to make [toggling] shortcut keys to superscript and subscript, respectively?

M

Mann Lee

We all know there are built-in shortcut keys for Font.underline
[CTRL+u], .italic [CTRL+i], .bold [CTRL+b]and corresponding toolbar
buttons in Excel.
They are toggling shortcut keys which even work during typing/editing
in a cell, which is very convenient.
I've been struggling to make such shortcut keys for superscript and
subscript, without success.
Would anyone kindly tell me how?
I am currently trying to learn EXCEL 2000 VBA and ACCESS 2000 VBA.
 
B

Bob Phillips

There are no built-in shortcuts for these. You could write your own UDF, but
this won't work in edit mode on a cell.
Maybe John Walkenbach's SuperSub add-in would be what you want.

Allows selecting text to Super or Sub.

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


--

HTH


RP
(remove nothere from the email address if mailing direct)
 
J

Jack Sons

Bob,

Strange, because I know they exist in Word 2000. Why not in Excel 2000?
Can't they be "transplanted" from Word to Excel? I guess the same internal
program(language) is behind Word and Excel (VBA)?

Jack Sons
The Netherlands

Bob Phillips said:
There are no built-in shortcuts for these. You could write your own UDF, but
this won't work in edit mode on a cell.
Maybe John Walkenbach's SuperSub add-in would be what you want.

Allows selecting text to Super or Sub.

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


--

HTH


RP
(remove nothere from the email address if mailing direct)


Mann Lee said:
We all know there are built-in shortcut keys for Font.underline
[CTRL+u], .italic [CTRL+i], .bold [CTRL+b]and corresponding toolbar
buttons in Excel.
They are toggling shortcut keys which even work during typing/editing
in a cell, which is very convenient.
I've been struggling to make such shortcut keys for superscript and
subscript, without success.
Would anyone kindly tell me how?
I am currently trying to learn EXCEL 2000 VBA and ACCESS 2000 VBA.
 
N

Nick Hodge

Jack

Not looked at shortcut keys recently, but these will do for your needs.
They can be assigned to shortcut keys of your choice via the
Tools>Macro>Macros...>Options... button

Sub ToggleStrikeThrough()
If ActiveCell.Font.Strikethrough = True Then
Selection.Font.Strikethrough = False
Exit Sub
End If
Selection.Font.Strikethrough = True
End Sub

Sub ToggleSuperScript()
If ActiveCell.Font.Superscript = True Then
Selection.Font.Superscript = False
Exit Sub
End If
Selection.Font.Superscript = True
End Sub

Sub ToggleSubScript()
If ActiveCell.Font.Subscript = True Then
Selection.Font.Subscript = False
Exit Sub
End If
Selection.Font.Subscript = True
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)


Jack Sons said:
Bob,

Strange, because I know they exist in Word 2000. Why not in Excel 2000?
Can't they be "transplanted" from Word to Excel? I guess the same internal
program(language) is behind Word and Excel (VBA)?

Jack Sons
The Netherlands

Bob Phillips said:
There are no built-in shortcuts for these. You could write your own UDF, but
this won't work in edit mode on a cell.
Maybe John Walkenbach's SuperSub add-in would be what you want.

Allows selecting text to Super or Sub.

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


--

HTH


RP
(remove nothere from the email address if mailing direct)


Mann Lee said:
We all know there are built-in shortcut keys for Font.underline
[CTRL+u], .italic [CTRL+i], .bold [CTRL+b]and corresponding toolbar
buttons in Excel.
They are toggling shortcut keys which even work during typing/editing
in a cell, which is very convenient.
I've been struggling to make such shortcut keys for superscript and
subscript, without success.
Would anyone kindly tell me how?
I am currently trying to learn EXCEL 2000 VBA and ACCESS 2000 VBA.
 
N

Nick Hodge

Reading back through the post, these also will not work in Edit mode. In
fact nothing will in VBA

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)


Nick Hodge said:
Jack

Not looked at shortcut keys recently, but these will do for your needs.
They can be assigned to shortcut keys of your choice via the
Tools>Macro>Macros...>Options... button

Sub ToggleStrikeThrough()
If ActiveCell.Font.Strikethrough = True Then
Selection.Font.Strikethrough = False
Exit Sub
End If
Selection.Font.Strikethrough = True
End Sub

Sub ToggleSuperScript()
If ActiveCell.Font.Superscript = True Then
Selection.Font.Superscript = False
Exit Sub
End If
Selection.Font.Superscript = True
End Sub

Sub ToggleSubScript()
If ActiveCell.Font.Subscript = True Then
Selection.Font.Subscript = False
Exit Sub
End If
Selection.Font.Subscript = True
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)


Jack Sons said:
Bob,

Strange, because I know they exist in Word 2000. Why not in Excel 2000?
Can't they be "transplanted" from Word to Excel? I guess the same
internal
program(language) is behind Word and Excel (VBA)?

Jack Sons
The Netherlands

Bob Phillips said:
There are no built-in shortcuts for these. You could write your own UDF, but
this won't work in edit mode on a cell.
Maybe John Walkenbach's SuperSub add-in would be what you want.

Allows selecting text to Super or Sub.

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


--

HTH


RP
(remove nothere from the email address if mailing direct)


We all know there are built-in shortcut keys for Font.underline
[CTRL+u], .italic [CTRL+i], .bold [CTRL+b]and corresponding toolbar
buttons in Excel.
They are toggling shortcut keys which even work during typing/editing
in a cell, which is very convenient.
I've been struggling to make such shortcut keys for superscript and
subscript, without success.
Would anyone kindly tell me how?
I am currently trying to learn EXCEL 2000 VBA and ACCESS 2000 VBA.
 
B

Bob Phillips

Jack,

That is because Word is a word processor, and super/subscripts are an
intrinsic element of those. It is not so with Excel, so I guess that the
developers didn't see to build that in.

The Office suite share a lot of components, dictionary, language settings
etc., but they also have a lot of differences, based upon the individual
object models, and to exploit the product objectives. And of course, whilst
some co-operation takes place in Redmond, there are separate development
teams.

As to VBA, this is not relevant, as it is just the macro language, it is not
what the code is developed in, that would be C++.

The big problem with macro solutions is that they cannot be invoked whilst
the cell is in edit-mode, so whilst you could select say one word in a three
word cell and underline it (Ctrl-U), you couldn't do the same to invoke a
superscript macro, it would be all or nothing. And I believe that in most
instance you only want to super/subscript part, such as CO2 only wants the 2
subscripted.

--

HTH

RP
(remove nothere from the email address if mailing direct)


Jack Sons said:
Bob,

Strange, because I know they exist in Word 2000. Why not in Excel 2000?
Can't they be "transplanted" from Word to Excel? I guess the same internal
program(language) is behind Word and Excel (VBA)?

Jack Sons
The Netherlands

Bob Phillips said:
There are no built-in shortcuts for these. You could write your own UDF, but
this won't work in edit mode on a cell.
Maybe John Walkenbach's SuperSub add-in would be what you want.

Allows selecting text to Super or Sub.

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


--

HTH


RP
(remove nothere from the email address if mailing direct)


Mann Lee said:
We all know there are built-in shortcut keys for Font.underline
[CTRL+u], .italic [CTRL+i], .bold [CTRL+b]and corresponding toolbar
buttons in Excel.
They are toggling shortcut keys which even work during typing/editing
in a cell, which is very convenient.
I've been struggling to make such shortcut keys for superscript and
subscript, without success.
Would anyone kindly tell me how?
I am currently trying to learn EXCEL 2000 VBA and ACCESS 2000 VBA.
 
J

Jack Sons

Bob,

It is perfectly clear to me now, I think.
The C++ programmers did not build in the possibility of sub- or
superscriping a part of the cell content, so there it stops. We can't reach
the C++ stuff with VBA or in any other way (source code is not public
anyway).
Correct?

Jack.

Bob Phillips said:
Jack,

That is because Word is a word processor, and super/subscripts are an
intrinsic element of those. It is not so with Excel, so I guess that the
developers didn't see to build that in.

The Office suite share a lot of components, dictionary, language settings
etc., but they also have a lot of differences, based upon the individual
object models, and to exploit the product objectives. And of course, whilst
some co-operation takes place in Redmond, there are separate development
teams.

As to VBA, this is not relevant, as it is just the macro language, it is not
what the code is developed in, that would be C++.

The big problem with macro solutions is that they cannot be invoked whilst
the cell is in edit-mode, so whilst you could select say one word in a three
word cell and underline it (Ctrl-U), you couldn't do the same to invoke a
superscript macro, it would be all or nothing. And I believe that in most
instance you only want to super/subscript part, such as CO2 only wants the 2
subscripted.

--

HTH

RP
(remove nothere from the email address if mailing direct)


Jack Sons said:
Bob,

Strange, because I know they exist in Word 2000. Why not in Excel 2000?
Can't they be "transplanted" from Word to Excel? I guess the same internal
program(language) is behind Word and Excel (VBA)?

Jack Sons
The Netherlands

Bob Phillips said:
There are no built-in shortcuts for these. You could write your own
UDF,
but
this won't work in edit mode on a cell.
Maybe John Walkenbach's SuperSub add-in would be what you want.

Allows selecting text to Super or Sub.

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


--

HTH


RP
(remove nothere from the email address if mailing direct)


We all know there are built-in shortcut keys for Font.underline
[CTRL+u], .italic [CTRL+i], .bold [CTRL+b]and corresponding toolbar
buttons in Excel.
They are toggling shortcut keys which even work during typing/editing
in a cell, which is very convenient.
I've been struggling to make such shortcut keys for superscript and
subscript, without success.
Would anyone kindly tell me how?
I am currently trying to learn EXCEL 2000 VBA and ACCESS 2000 VBA.
 
J

Jack Sons

Nick,

Thanks for the effort.

Jack.

Nick Hodge said:
Reading back through the post, these also will not work in Edit mode. In
fact nothing will in VBA

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)


Nick Hodge said:
Jack

Not looked at shortcut keys recently, but these will do for your needs.
They can be assigned to shortcut keys of your choice via the
Tools>Macro>Macros...>Options... button

Sub ToggleStrikeThrough()
If ActiveCell.Font.Strikethrough = True Then
Selection.Font.Strikethrough = False
Exit Sub
End If
Selection.Font.Strikethrough = True
End Sub

Sub ToggleSuperScript()
If ActiveCell.Font.Superscript = True Then
Selection.Font.Superscript = False
Exit Sub
End If
Selection.Font.Superscript = True
End Sub

Sub ToggleSubScript()
If ActiveCell.Font.Subscript = True Then
Selection.Font.Subscript = False
Exit Sub
End If
Selection.Font.Subscript = True
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)


Jack Sons said:
Bob,

Strange, because I know they exist in Word 2000. Why not in Excel 2000?
Can't they be "transplanted" from Word to Excel? I guess the same
internal
program(language) is behind Word and Excel (VBA)?

Jack Sons
The Netherlands

"Bob Phillips" <[email protected]> schreef in bericht
There are no built-in shortcuts for these. You could write your own UDF,
but
this won't work in edit mode on a cell.
Maybe John Walkenbach's SuperSub add-in would be what you want.

Allows selecting text to Super or Sub.

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


--

HTH


RP
(remove nothere from the email address if mailing direct)


We all know there are built-in shortcut keys for Font.underline
[CTRL+u], .italic [CTRL+i], .bold [CTRL+b]and corresponding toolbar
buttons in Excel.
They are toggling shortcut keys which even work during typing/editing
in a cell, which is very convenient.
I've been struggling to make such shortcut keys for superscript and
subscript, without success.
Would anyone kindly tell me how?
I am currently trying to learn EXCEL 2000 VBA and ACCESS 2000 VBA.
 
B

Bob Phillips

Jack,

That's about it, although I wouldn't say they didn't build in the
possibility (as I have no idea), just they that didn't build it in. They may
build it one day, but to get a true shortcut driven facility, I think it
needs MS to do it.

--

HTH

RP
(remove nothere from the email address if mailing direct)


Jack Sons said:
Bob,

It is perfectly clear to me now, I think.
The C++ programmers did not build in the possibility of sub- or
superscriping a part of the cell content, so there it stops. We can't reach
the C++ stuff with VBA or in any other way (source code is not public
anyway).
Correct?

Jack.

Bob Phillips said:
Jack,

That is because Word is a word processor, and super/subscripts are an
intrinsic element of those. It is not so with Excel, so I guess that the
developers didn't see to build that in.

The Office suite share a lot of components, dictionary, language settings
etc., but they also have a lot of differences, based upon the individual
object models, and to exploit the product objectives. And of course, whilst
some co-operation takes place in Redmond, there are separate development
teams.

As to VBA, this is not relevant, as it is just the macro language, it is not
what the code is developed in, that would be C++.

The big problem with macro solutions is that they cannot be invoked whilst
the cell is in edit-mode, so whilst you could select say one word in a three
word cell and underline it (Ctrl-U), you couldn't do the same to invoke a
superscript macro, it would be all or nothing. And I believe that in most
instance you only want to super/subscript part, such as CO2 only wants
the
2
subscripted.

--

HTH

RP
(remove nothere from the email address if mailing direct)


Jack Sons said:
Bob,

Strange, because I know they exist in Word 2000. Why not in Excel 2000?
Can't they be "transplanted" from Word to Excel? I guess the same internal
program(language) is behind Word and Excel (VBA)?

Jack Sons
The Netherlands

"Bob Phillips" <[email protected]> schreef in bericht
There are no built-in shortcuts for these. You could write your own UDF,
but
this won't work in edit mode on a cell.
Maybe John Walkenbach's SuperSub add-in would be what you want.

Allows selecting text to Super or Sub.

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


--

HTH


RP
(remove nothere from the email address if mailing direct)


We all know there are built-in shortcut keys for Font.underline
[CTRL+u], .italic [CTRL+i], .bold [CTRL+b]and corresponding toolbar
buttons in Excel.
They are toggling shortcut keys which even work during typing/editing
in a cell, which is very convenient.
I've been struggling to make such shortcut keys for superscript and
subscript, without success.
Would anyone kindly tell me how?
I am currently trying to learn EXCEL 2000 VBA and ACCESS 2000 VBA.
 

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