Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-08-2014, 02:47 PM
htownpaper htownpaper is offline excel update superscript by 1 Windows 8 excel update superscript by 1 Office 2010 64bit
Novice
excel update superscript by 1
 
Join Date: Dec 2014
Posts: 5
htownpaper is on a distinguished road
Default excel update superscript by 1

Hi All,

Please ignore the title. this is for word not excel.



Hope you guys are doing good. I have a manual list of superscripts like

item^1
item^2
item^3

Is there a shortcut to have it read:

item^2
item^3
item^4

Last edited by htownpaper; 12-08-2014 at 05:39 PM.
Reply With Quote
  #2  
Old 12-08-2014, 05:25 PM
macropod's Avatar
macropod macropod is online now excel update superscript by 1 Windows 7 64bit excel update superscript by 1 Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Is this for Word or Excel? Your title refers to Excel, but you've posted in the Word forum.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 12-08-2014, 05:39 PM
htownpaper htownpaper is offline excel update superscript by 1 Windows 8 excel update superscript by 1 Office 2010 64bit
Novice
excel update superscript by 1
 
Join Date: Dec 2014
Posts: 5
htownpaper is on a distinguished road
Default

sorry word.
Reply With Quote
  #4  
Old 12-08-2014, 05:45 PM
macropod's Avatar
macropod macropod is online now excel update superscript by 1 Windows 7 64bit excel update superscript by 1 Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Assuming the numbers are superscripted text (not footnote/endnote references and the like), you could use a macro like:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "[0-9]@>"
    .Font.Superscript = True
    .Replacement.Text = ""
    .Format = True
    .Forward = True
    .Wrap = wdFindStop
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    .Text = CLng(.Text + 1)
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
End Sub
For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm
For Mac macro installation & usage instructions, see: http://word.mvps.org/Mac/InstallMacro.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 12-08-2014, 06:03 PM
htownpaper htownpaper is offline excel update superscript by 1 Windows 8 excel update superscript by 1 Office 2010 64bit
Novice
excel update superscript by 1
 
Join Date: Dec 2014
Posts: 5
htownpaper is on a distinguished road
Default

quick question,

how could I set the increment the superscript based upon the value of the preceeding superscript.

for example

x^1
x^32
x^66

would become

x^1
x^2
x^3
Reply With Quote
  #6  
Old 12-08-2014, 06:11 PM
macropod's Avatar
macropod macropod is online now excel update superscript by 1 Windows 7 64bit excel update superscript by 1 Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You could use:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long
i = 0
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "[0-9]@>"
    .Font.Superscript = True
    .Replacement.Text = ""
    .Format = True
    .Forward = True
    .Wrap = wdFindStop
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    .Text = i
    i = i + 1
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
End Sub
Where I have 'i = 0', simply replace the 0 with whatever you want the starting # to be.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 12-08-2014, 06:12 PM
htownpaper htownpaper is offline excel update superscript by 1 Windows 8 excel update superscript by 1 Office 2010 64bit
Novice
excel update superscript by 1
 
Join Date: Dec 2014
Posts: 5
htownpaper is on a distinguished road
Default

got it!
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "[0-9]@>"
    .Font.Superscript = True
    .Replacement.Text = ""
    .Format = True
    .Forward = True
    .Wrap = wdFindStop
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    If .Text = "0" Then
      .Text = CLng(.Text + 1)
      i = 1
    Else
      .Text = CLng(i + 1)
      i = i + 1
      .Collapse wdCollapseEnd
      .Find.Execute
    End If
  Loop
End With
Application.ScreenUpdating = True
End Sub

Last edited by macropod; 12-08-2014 at 06:33 PM. Reason: Added code tags & formatting
Reply With Quote
  #8  
Old 12-08-2014, 06:17 PM
htownpaper htownpaper is offline excel update superscript by 1 Windows 8 excel update superscript by 1 Office 2010 64bit
Novice
excel update superscript by 1
 
Join Date: Dec 2014
Posts: 5
htownpaper is on a distinguished road
Default

actually this is right:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "[0-9]@>"
    .Font.Superscript = True
    .Replacement.Text = ""
    .Format = True
    .Forward = True
    .Wrap = wdFindStop
    .MatchWildcards = True
    .Execute
  End With
  i = 0
  Do While .Find.Found
    .Text = CLng(i + 1)
    .Collapse wdCollapseEnd
    .Find.Execute
    i = i + 1
  Loop
End With
Application.ScreenUpdating = True
End Sub

Last edited by macropod; 12-08-2014 at 06:35 PM. Reason: Added code tags & formatting
Reply With Quote
  #9  
Old 12-08-2014, 06:38 PM
macropod's Avatar
macropod macropod is online now excel update superscript by 1 Windows 7 64bit excel update superscript by 1 Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The code in your last post is essentially the same as what I posted in post #6, except that you have an unnecessary CLng conversion - '.Text = CLng(i + 1)'

PS: When posting code, please use the code tags. They're indicated by the # button on the posting menu.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel update superscript by 1 How to custom Date Picker CC format with Ordinal and superscript it! areriff Word VBA 5 08-21-2022 04:28 PM
Insert superscript into a textbox Deltaj Word VBA 3 11-30-2014 04:23 PM
excel update superscript by 1 Replace with superscript in Word 2013 docbike Word 4 04-07-2014 05:23 PM
Combining Files--Superscript problem lindajacques PowerPoint 0 01-06-2011 01:20 PM
excel update superscript by 1 Inserting Date, formatting to superscript and subscript louq Word 1 10-22-2009 09:29 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:28 AM.


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