+ Reply to Thread
Results 1 to 9 of 9

macro Delete string text between brackets in several cells

Hybrid View

raparigo74 macro Delete string text... 05-26-2011, 05:53 AM
johnjohns Re: macro Delete string text... 05-26-2011, 06:04 AM
raparigo74 Re: macro Delete string text... 05-26-2011, 06:18 AM
johnjohns Re: macro Delete string text... 05-26-2011, 06:35 AM
pike Re: macro Delete string text... 05-26-2011, 06:37 AM
raparigo74 Re: macro Delete string text... 05-26-2011, 08:56 AM
pike Re: macro Delete string text... 05-26-2011, 04:34 PM
Leith Ross Re: macro Delete string text... 05-26-2011, 06:19 PM
pike Re: macro Delete string text... 05-27-2011, 04:19 AM
  1. #1
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: macro Delete string text between brackets in several cells

    hi raparigo74,

    UDF is user defined function.. you can make functions like the built-in excel worksheet functions.

    http://www.techbookreport.com/tutorials/excel_vba1.html

    so place the code in a module you can then use the "Match_Replace" UDF

    eg
    a1 = word1 (123) word2 (456)
     B1= Match_Replace(A1)
    the result in B1 will be "word1 word2 "

    It is recommended to use "Function"s instead of "Sub"s in both worksheets and VBA
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: macro Delete string text between brackets in several cells

    Hello Pike,

    You could reduce the Pattern to this:
    .Pattern = "(\(.+\))"

    This will catch all characters rather than space, 0-9,A-Z,a-z, and underscore. If there is a chance that the parentheses could be empty then use this pattern:
    .Pattern = "(\(.*\))"
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1