Consulting

Results 1 to 9 of 9

Thread: Deleting specific text, but not all, in parentheses

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Nov 2020
    Posts
    15
    Location

    Thumbs up Deleting specific text, but not all, in parentheses

    Hi, I have been trying to solve this for days. I have tried manipulating every example I could find online, but nothing works the way I need it. I just can't figure out how to have the VBA only process something if it is within an opening parentheses "(" and to stop looking if find "%)" The way mine is working is that it may sometimes delete everything from a semicolon in regular text to %). Oops.

    One problem is that the phrases are not always the same length. The other is that sometimes a comma is used and sometimes a semicolon.

    I have text within parentheses that I want to find and only keep "(" up to the ";" or "," and then delete from to "%)"

    Another way to do it, I think, could be from within parentheses - any phrase after ; or , that contains ">" or "<"

    Example: I want to delete everything after the semicolon through "%)"

    (VCI = 106, PR = 66, Average range, CI = 98-113; VCI > MIS, BR = <=15%) To:
    (
    VCI = 106, PR = 66, Average range, CI = 98-113)
    ------

    I also want to completely delete the phrase below. From "(" to ")"
    (VCI > WMI, BR = 21.6%; VCI > PSI, BR = 1.7%)


    Thing that I want to keep the same:
    (SI = 11; VC = 11)
    (SI = 11, VC = 10)
    (SI = 8, VC = 8)
    (IN = 7)

    Another problem is that there are different abbreviations (2 or 3), numbers can have a length of 1, 2, 3, or 4, BR =<= can be different (but always include < or >

    I'm not if this makes sense. I'm uploading a document. I'm not pasting code I've tried since it all failed in some way and there are about 50 atttempts.

    Thank you so much!

    Btw, I am a school psychologist working for a single psychologist. Deleting all of the above from reports takes forever and insurance does not cover much that I do. "Boss" is my husband...

    -Ashley
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •