Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-03-2010, 07:41 AM
judicial85 judicial85 is offline Excel 2010 Custom Ribbon Windows 7 Excel 2010 Custom Ribbon Office 2010 (Version 14.0)
Advanced Beginner
Excel 2010 Custom Ribbon
 
Join Date: Nov 2010
Posts: 64
judicial85 is on a distinguished road
Default Excel 2010 Custom Ribbon

Hello!

Does anybody know how or if I can place sub/super-scripts in the custom ribbon in excel? Those buttons don't seem to be available in Excel like Word/Powerpoint however, the text options are present in the "Format Cells" window. If this is not possible, any idea why...?

Bryan
Reply With Quote
  #2  
Old 12-04-2010, 01:33 AM
Kaneto Kaneto is offline Excel 2010 Custom Ribbon Windows 7 Excel 2010 Custom Ribbon Office 2010 (Version 14.0)
Competent Performer
 
Join Date: Nov 2010
Posts: 136
Kaneto is on a distinguished road
Default

The buttons for placing superscript and subscript on the custom ribbon aren't built-in, but you can create them pretty easily with VBA.

First, create a new workbook. You're going to want to save it in c:\users\[username]\AppData\Roaming\Microsoft\Excel\XLSTART. Name it personal.xlsb (an Excel binary workbook).

Next you'll need to access the Developer ribbon.
1. Click the File Menu and choose Options.
2. Click on Customize Ribbon.
3. In the right-hand pane, check the box next to Developer.
4. Click OK.

Now to create the macros.
1. Click on the Developer ribbon.
2. Click on Macros.
3. Enter a name for your macro in the Macro name: box (e.g. Superscript).
4. Click the Create button.
5. For Superscript, enter the following code into the VBA box:
Code:
Sub Superscript()
    With Selection.Font
        .Superscript = True
    End With
End Sub
6. Go back to the Excel window, and repeat steps 2-4 for the Subscript macro.
7. Enter the following code in the VBA box for subscript:
Code:
Sub Subscript()
    With Selection.Font
        .Subscript = True
    End With
End Sub
8. Close the VBA editor and save the Excel file (don't put anything in the cells unless you want them to appear in every new excel file).

Now to add the Quick Access buttons:
1. Click on the File menu and choose Options.
2. Click on Quick Access Toolbar.
3. In the Choose commands from: drop-down, pick Macros
4. Select your Superscript and Subscript macros and Add them.
5. Optional: Change the icons for your buttons by highlighting them in the right-hand pane and clicking the Modify button.
6. Click OK when you are done.

That should do it. Hope this helps.

-SW
Reply With Quote
  #3  
Old 12-05-2010, 06:41 PM
judicial85 judicial85 is offline Excel 2010 Custom Ribbon Windows 7 Excel 2010 Custom Ribbon Office 2010 (Version 14.0)
Advanced Beginner
Excel 2010 Custom Ribbon
 
Join Date: Nov 2010
Posts: 64
judicial85 is on a distinguished road
Default

Thought I might have to go that route! I macro-ed the export picture function however and have used it A LOT.

Just for fun, is there a way I can "steal" the sub/super-script icons from ppt/word and put those in the modify button window?

Bryan
Reply With Quote
  #4  
Old 12-05-2010, 07:22 PM
judicial85 judicial85 is offline Excel 2010 Custom Ribbon Windows 7 Excel 2010 Custom Ribbon Office 2010 (Version 14.0)
Advanced Beginner
Excel 2010 Custom Ribbon
 
Join Date: Nov 2010
Posts: 64
judicial85 is on a distinguished road
Default

Actually, do you have any ideas for improving this code? Right now, the code can make subscript or remove subscript on one click, but ONLY if you click on the WHOLE cell (i.e. A4, B2, etc). I'm wondering how to alter this so that I can highlight one or two things in a cell for subscripting (i.e. Ba2CuO3 - only the numbers, not the whole cell entry).

Bryan (sorry - I don't know where the code box button is here)


Sub Subscript()
If Selection.Font.Subscript = True Then
With Selection.Font
.Subscript = False
End With
Else
With Selection.Font
.Subscript = True
End With
End If
End Sub
Reply With Quote
Reply

Tags
ribbon, subscript, superscript

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2010 view of cel missing isla Excel 2 09-27-2013 09:35 AM
Creating custom tabs for Word & Excel 2003 on a Windows 7 OS Skarab Office 1 07-05-2010 09:23 AM
Embedded Excel Spreadsheet in Word Loses Ribbon amoncur Word 0 07-03-2010 09:22 PM
Embedded Excel Graphs - Custom Formatting Cody Drawing and Graphics 0 07-02-2010 02:30 PM
Excel Error Loading Custom UI XML sumdumgai Office 1 05-10-2010 06:59 PM

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 02:59 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2021 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft