![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
Is there a way to superscript or subscript only part of a cell's text? The forum below provides VBA to superscript an entire cell.
How about just part of a cell? e.g. A1 = m3, I want to superscript the 3. http://www.mrexcel.com/board/viewtop...ic=856&forum=2 [ This Message was edited by: Cosmos75 on 2002-04-19 11:39 ] |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sunny, spring-like Hull
Posts: 3,339
|
Type in 'M', click on Format- Cells- Font and change to subscript, then type in the 3. You might be able to build yourself a custom toolbar to do this with a single click.
|
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
A1 = m3
Yeah, highlight the "3", right click, choose "Format Cells" and then tick the Subscript/Superscript (whatever) box that you want. |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
And this is a complete pain in the @$$. At least Word has shortcut keys for this.
|
|
|
|
|
|
#5 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Quote:
|
|
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
SORRY! I guess I should have been more specific, I meant is there a way to do this from within VBA?
|
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Feb 2002
Posts: 3,065
|
cosom
hi yes you can im sure i have some code SOMEWHERE i have no excel at home, ill try to find it and it will find test and super it.
__________________
Free Excel based Web Toolbar available here. Jack in the UK J & R Excel Solutions "making Excel work for you" |
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sunny, spring-like Hull
Posts: 3,339
|
Just recording a macro gives this (minus all the bumf):
With ActiveCell.Characters(Start:=2, Length:=1).Font .Superscript = False .Subscript = True End With Just replace ActiveCell with a Range and select the Start of the letters to be Subscripted and how many you want to be done. [ This Message was edited by: Mudface on 2002-04-19 11:19 ] |
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
Mudface,
What if I don't know where the I want to start the superscript or how many characters there are? What about if I am just typying in text, and the use the arrow to go back and select part of the text, and then run a macro to superscript the selected part of the text? I hope that wasn't too convoluted.... Say I type "The volume of the cylinder is 42 m3", the press the arrow key once (to have the cursor before 3, hold down shift, go forwar to select 3. NOW, I want to run a macro or script to superscript the selected part of the text, in this case the 3. Can this even be done?? [ This Message was edited by: Cosmos75 on 2002-04-19 11:24 ] |
|
|
|
|
|
#10 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sunny, spring-like Hull
Posts: 3,339
|
1 You're stuck.
2 Not sure, I don't think there's a way to pick up that you've actually selected something within a cell (although no doubt I'll be proved wrong |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|