#1
|
|||
|
|||
Search and Convert case of certain part of the word
Hello, forums members,
I have gene names with special styles (fyuA, fimH ..etc) so how to search and replace for gene names that had been written in this format (fyuA, fimH) to this format (fyuA, fimH ..etc). I can't search for just fyu or fim, because I have other words with the same prefix, hence to prevent misreplace. Thank you |
#2
|
||||
|
||||
If you format an instance the way you want it, then select it and copy to clipboard.
Now open the Find/Replace dialog and paste the contents of the clipboard into the Find: box. In the Replace with: box, put ^c This will then find the text and replace it with the contents of the clipboard.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
||||
|
||||
You could probably replace using wildcards Replace using wildcards e.g.
Code:
Sub Macro1() Dim oRng As Range Set oRng = ActiveDocument.Range With oRng.Find Do While .Execute(findText:="<[a-z]{3}[A-Z]{1}>", MatchWildcards:=True) oRng.Select If MsgBox("Replace?", vbYesNo) = vbYes Then oRng.Font.Italic = True oRng.Characters.Last.Font.Italic = False End If oRng.Collapse 0 Loop End With Set oRng = Nothing End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#4
|
|||
|
|||
Quote:
Many thanks, Mr. Andrew I convert it to macro: 116.png |
#5
|
|||
|
|||
Quote:
That is what I want, many thanks Please how to disable the message box, and I want to replace all at once, because I don't want to go through the document. Thanks again |
#6
|
||||
|
||||
Remove the two lines that begin with If and End If
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#7
|
|||
|
|||
Thank you thank you thank you Mr. gmayor
Best wishes, laith |
Tags |
word 16, word 19, word replacing |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How do I convert a line of text to title case? | neilfxb | Word | 21 | 02-22-2023 12:47 PM |
VBA to convert a line of text to title case | jeffreybrown | Word VBA | 14 | 09-09-2019 05:37 AM |
Toggle between upper case, lower case, etc... by one single macro on a Mac, to emulate Shift + F3 on | gloub | Word VBA | 2 | 01-30-2019 12:40 PM |
How do I search for terms in initial upper-case? | bertietheblue | Word | 5 | 05-02-2012 05:24 AM |
Search for paras beginging with a lower case | MShroff | Word | 1 | 10-19-2010 06:41 AM |