Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks to both of you. Unfortunately, Dave, I'm doing this for work
and won't be able to do an addin such as this. And for the latter, the characters that will be selected vary each and every time. I was hoping to be able to go into a cell, highlight the particular characters I want, and then hit, for example, CTRL+S to superscript that which I had highlighted. I knew it wasn't going to be easy, so it looks like I'll just have to do this one the hard way. Thanks anyway. Frank On Tue, 7 Aug 2007 05:30:02 -0700, p45cal wrote: You probably know already that the likes of ActiveCell.Characters(Start:=4, Length:=7).Font.Superscript = True superscripts part of a string in a cell. The trouble is determining Start and Length. If you wanted to superscript the first occurrence of 'th' in a string, you know that Length is 2. InStr(ActiveCell, "th") will tell you where it starts. So the single line: ActiveCell.Characters(Start:=InStr(ActiveCell, "th"), Length:=2).Font.Superscript = True does this. To help develop this more easily you could do the likes of: Sub blah() myStart = InStr(ActiveCell, "th") myLength = 2 ActiveCell.Characters(Start:=myStart, Length:=myLength).Font.Superscript = True End Sub Now you play about with the first two lines. For example if you knew the start of superscripting had to take place straight after the character combination 'Vbn' then myStart=Instr(Activecell,"Vbn")+3 is what you'd need. There's a wide variety of ways to discover where things are in a string, so what is it that you're looking for? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
superscript/subscript | Excel Discussion (Misc queries) | |||
Subscript and Superscript with the TEXT function | Excel Worksheet Functions | |||
Subscript & Superscript | Excel Discussion (Misc queries) | |||
Button to format selected text as subscript | Excel Programming |