#1
|
|||
|
|||
Numbers Removal in a brackets
Hi,
In a document i want to remove a text within the brackets (including brackets) having symbols "+" or "-" or Both. Ex: Text should contains symbols "PLUS (+), MINUS (-) , BOTH (+)(-)" then remove the text within the brackets along with the brackets. Doc Type : Docx & RTF Input: ABC (1255+3456-211+4332) DEF (123+456+678) GHI (123-456-678) Your Help is Highly Appreciated. Output: ABC DEF GHI Last edited by ranjan; 05-19-2022 at 05:06 AM. Reason: Added Doc Type |
#2
|
||||
|
||||
This requires nothing more than a straightforward wildcard Find/Replace. What have you tried? I suggest you look at your own code here: https://www.msofficeforums.com/word-...-brackets.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Hi Macropod,
Its working fine but am facing small issue with this code. code is completely removing the text within the brackets having numbers.. Ex: If total is presented in negative value then its completely deleting the total value.. I want to delete the text having +,- or both combination withint the brackets. Total (2345,99) This shouldnt be removed, but my code was removing the total value also, is there any possibility to remove text in the brackets having +,- or both combination. Input: ABC (1255+3456-211+4332) DEF (123+456+678) GHI (123-456-678) TOTAL (123,456) Output: ABC DEF GHI TOTAL (123,456) Could you please review the below one: Code:
Sub Test_Replace() With ActiveDocument.Content.Find .Text = "\(*\)" .Replacement.Text = "" .ClearFormatting .Replacement.ClearFormatting .MatchWildcards = True .Execute Replace:=wdReplaceAll End With End Sub |
#4
|
||||
|
||||
You really need to invest more effort into learning how to use wildcards. See: Finding and replacing characters using wildcards
.Text = "\([!\(]@[+\-][!\(]@\)"
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
numbers removal |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Excel 2019: How to display the sign of numbers in another field in brackets? | Jamal NUMAN | Excel | 3 | 09-16-2021 09:44 AM |
Need Wild Card for Deleting Square Brackets with Differing Numbers inside | CrossReach | Word | 6 | 11-26-2019 01:02 PM |
Bold numbers between square brackets | jeffreybrown | Word | 4 | 02-13-2017 04:32 PM |
Help with: Replace and reformat numbers inside square brackets | johnbrowny | Word | 1 | 02-13-2016 06:45 PM |
Find and Replace - How to insert brackets around all numbers in a doc | Natedogg | Word | 2 | 05-21-2015 07:16 AM |