Results 1 to 8 of 8

Remove text between [brackets]

Threaded View

  1. #1
    Registered User
    Join Date
    07-25-2014
    Location
    London
    MS-Off Ver
    2007
    Posts
    3

    Remove text between [brackets]

    Hi @ all,

    I use a macro for deleting a text between two brackets in a range("a1:a6000").
    Dim c As Range
    Dim p1 As Double
    Dim p2 As Double
    For Each c In Range("a1:a60")
    p1 = InStr(c, "[")
    p2 = InStr(c, "]")
    If p1 > 0 Then c.Value = Left(c, p1 - 1) & Right(c, Len(c) - p2 - 0)
    
    Next c
    it works fine but only for the first pair of brackets:

    something like "cars[ss,s,c]" becomes "cars"

    but:

    auto[o,au]mo[o,au]bi[i,ay,ai]le becomes automo[o,au]bi[i,ay,ai]le


    how can I modify the code to delete all the text between all the bracket pairs in a cell ?


    Many thanks in advance for any help!
    Gr.Benni
    Last edited by Benni5555; 07-25-2014 at 10:26 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Remove commas if they are between brackets
    By lukesmith7 in forum Excel General
    Replies: 12
    Last Post: 06-25-2014, 05:18 AM
  2. Please help to remove numbers in brackets - abc (123)
    By gwmbox in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-13-2013, 08:53 AM
  3. Remove all data within (brackets)
    By duckboy1981 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-02-2009, 05:39 AM
  4. Remove brackets without format change
    By Oleg in forum Excel General
    Replies: 5
    Last Post: 01-19-2009, 09:42 AM
  5. Remove brackets
    By wei82 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-24-2007, 10:49 PM

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