Learn how to easily remove number characters before closing brackets in strings within Excel using VBA. This guide provides step-by-step instructions and sample code to streamline your data processing! --- This video is based on the question https://stackoverflow.com/q/72115461/ asked by the user 'AEE' ( https://stackoverflow.com/u/19034667/ ) and on the answer https://stackoverflow.com/a/72115631/ provided by the user 'thehappycheese' ( https://stackoverflow.com/u/1782370/ ) at 'Stack Overflow' website. Thanks to these great users and Stackexchange community for their contributions. Visit these links for original content and any more details, such as alternate solutions, latest updates/developments on topic, comments, revision history etc. For example, the original title of the Question was: Remove number characters appearing before a bracket in a string Also, Content (except music) licensed under CC BY-SA https://meta.stackexchange.com/help/l... The original Question post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license, and the original Answer post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license. If anything seems off to you, please feel free to write me at vlogize [AT] gmail [DOT] com. --- How to Remove Number Characters Before a Bracket in Strings Using VBA Are you working with an Excel spreadsheet that contains strings with numbered lists, like "1)orange 2)blue 3)white 4)purple," and need to clean them up? Removing the number characters before the brackets can be a tedious task if done manually, but with Visual Basic for Applications (VBA), this process can be automated efficiently. In this guide, we'll guide you through the steps to remove those unwanted characters quickly and effortlessly using a VBA script. Let's dive in! Understanding the Problem When you're dealing with strings that have numbers followed by a closing bracket (like 1), it can be cumbersome to strip away the numbers manually, especially if there are numerous rows of data. Our goal is to transform the string: [[See Video to Reveal this Text or Code Snippet]] into [[See Video to Reveal this Text or Code Snippet]] This is not only aesthetically pleasing but also makes further data manipulation easier. Step-by-Step Solution Follow the steps below to set up and run your VBA code that will handle this task efficiently: Step 1: Enable the Regex Library Before writing the code, we need to ensure that the regular expression (regex) library is enabled in your VBA editor. Here’s how you can do that: Open the Excel file you are working with. Press ALT + F11 to open the Visual Basic for Applications (VBA) editor. In the VBA editor, click on Tools in the menu bar. Select References from the dropdown menu. In the list that appears, check Microsoft VBScript Regular Expressions. Click OK to close the References window. Step 2: Writing the VBA Code Now we’ll write the VBA code to accomplish the task. Below is the script you can copy and paste into the VBA editor: [[See Video to Reveal this Text or Code Snippet]] Code Breakdown Dim input_string As String: This line declares a variable to hold the input string. Set regex = New RegExp: This initializes a new regular expression object. regex.Pattern = "\d+ )": The regex pattern \d+ ) matches one or more digits (\d+ ) followed by a closing bracket ()). regex.Global = True: This setting allows the regex to find all matches in the string, not just the first one. result = regex.Replace(input_string, ")"): This replaces all found patterns with just ). Debug.Print result: This outputs the cleaned string to the Immediate Window for verification. Step 3: Running the Code To run the code, simply press F5 or go to the top menu and click Run → Run Sub/UserForm. Check the Immediate Window (press CTRL + G if it's not visible) to see the cleaned string output. Conclusion Using the above method, you can efficiently remove number characters before brackets in Excel strings using VBA. This not only simplifies your data manipulation tasks but also enhances the presentation of your data. Feel free to customize the code for your specific needs or reach out if you have further questions! Happy coding!