#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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 7. Enter the following code in the VBA box for subscript: Code:
Sub Subscript() With Selection.Font .Subscript = True End With End Sub 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 |
#3
|
|||
|
|||
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 |
#4
|
|||
|
|||
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 |
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 |