Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-16-2021, 11:03 PM
laith93 laith93 is offline Search and Convert case of certain part of the word Windows 10 Search and Convert case of certain part of the word Office 2019
Competent Performer
Search and Convert case of certain part of the word
 
Join Date: Jul 2021
Posts: 117
laith93 is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 08-16-2021, 11:44 PM
Guessed's Avatar
Guessed Guessed is offline Search and Convert case of certain part of the word Windows 10 Search and Convert case of certain part of the word Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,991
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
  #3  
Old 08-16-2021, 11:58 PM
gmayor's Avatar
gmayor gmayor is offline Search and Convert case of certain part of the word Windows 10 Search and Convert case of certain part of the word Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
  #4  
Old 08-17-2021, 02:06 AM
laith93 laith93 is offline Search and Convert case of certain part of the word Windows 10 Search and Convert case of certain part of the word Office 2019
Competent Performer
Search and Convert case of certain part of the word
 
Join Date: Jul 2021
Posts: 117
laith93 is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
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.
Wow, it's a good and an amazing idea
Many thanks, Mr. Andrew

I convert it to macro:
116.png
Reply With Quote
  #5  
Old 08-17-2021, 02:12 AM
laith93 laith93 is offline Search and Convert case of certain part of the word Windows 10 Search and Convert case of certain part of the word Office 2019
Competent Performer
Search and Convert case of certain part of the word
 
Join Date: Jul 2021
Posts: 117
laith93 is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
You could probably replace using wildcards Replace using wildcards
Fantastic, thank you Mr. gmayor
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
Reply With Quote
  #6  
Old 08-17-2021, 04:23 AM
gmayor's Avatar
gmayor gmayor is offline Search and Convert case of certain part of the word Windows 10 Search and Convert case of certain part of the word Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
  #7  
Old 08-17-2021, 04:45 AM
laith93 laith93 is offline Search and Convert case of certain part of the word Windows 10 Search and Convert case of certain part of the word Office 2019
Competent Performer
Search and Convert case of certain part of the word
 
Join Date: Jul 2021
Posts: 117
laith93 is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
Remove the two lines that begin with If and End If
Thank you thank you thank you Mr. gmayor
Best wishes,
laith
Reply With Quote
Reply

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
Search and Convert case of certain part of the word VBA to convert a line of text to title case jeffreybrown Word VBA 14 09-09-2019 05:37 AM
Search and Convert case of certain part of the word 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

Other Forums: Access Forums

All times are GMT -7. The time now is 01:57 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