Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to write a script that will find any numeric supscripts or
superscripts in any cells of the activate worksheet and replace it with another character. I have not been able to do this successfully in Excel even when I do this manually through Excel's find and replace. It works when I remove the filter that restricts the search to just characters that are super or subscripted in a cell. I have no trouble doing this in Word as you can see from the snippit I used below for one of my Word projects. Is their an Excel equivalent? Selection.HomeKey Unit:=wdStory Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "([0-9]{1,2})" .Replacement.Text = "|\1|" .Forward = True .Wrap = wdFindwdFindStop .Format = True .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With While Selection.Find.Execute If Selection.Font.Superscript = True Then Selection.Find.Execute Replace:=wdReplaceOne Selection.MoveRight Unit:=wdCharacter, count:=1 End If With Selection.Find .Text = "([0-9]{1,2})" .Replacement.Text = "|\1|" .Forward = True .Wrap = wdFindStop .Format = True .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Wend Thanks. Harry Wishes |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find Replace loses text properties/formatting | Excel Worksheet Functions | |||
Find and Replace with Formatting | Excel Programming | |||
Find and Replace - delete the remainder of the text in the cell after my Find | Excel Programming | |||
Find and replace of word causes change of font formatting | New Users to Excel | |||
Find and Replace formatting inside of a macro | Excel Programming |