Options

Excel Macros

SieSie Member Posts: 1,195
Hi Guys, How are we all?

Quick question if you can help?

I want to know if its possible to copy data from one cell to another using a macro within Excel 2007.

Sounds easy but what I need is like this:

Cell A1 contains the data - Something Something (This Data) Something
I need to copy ONLY the section (This Data) to a new cell.

(This Data) is always contained within brackets.
(This Data) is the only data in brackets.
(This Data) is not always the same number of characters in length.

Any ideas?
This may need to be done for 100+ lines hence why I dont want to just cut and paste.

Thanks in advance for looking.
Foolproof systems don't take into account the ingenuity of fools

Comments

  • Options
    SieSie Member Posts: 1,195
    Hi all,

    This following formula copy the data from the cell.

    =TRIM(RIGHT(C1,LEN(C1)-SEARCH("(",C1)+1))

    Whilst it removes all characters from the left of the "(" it still includes the charcters from the right of the ")"

    Any ideas?
    Foolproof systems don't take into account the ingenuity of fools
  • Options
    astorrsastorrs Member Posts: 3,139 ■■■■■■□□□□
    Is this something you just need to do manually? Or does it need to update automatically from the source cell?
  • Options
    SieSie Member Posts: 1,195
    Hi Astorrs,

    Thanks for the reply.

    Its currently done manually (IE: text highlighted Ctrl+C and Ctrl+V in the right place)

    I have figured it out, for everyones information (Just incase you need to know?)

    =TRIM(LEFT(TRIM(RIGHT(B1,LEN(B1)-SEARCH("(",B1)+1)),SEARCH(")",TRIM(RIGHT(B1,LEN(B1)-SEARCH("(",B1)+1)))))

    The above formula takes the Text in brackets out of a string such:

    Hello this is a (Test) example of things

    Now wasnt that fun?
    Foolproof systems don't take into account the ingenuity of fools
  • Options
    spike_tomahawkspike_tomahawk Member Posts: 43 ■■□□□□□□□□
    Sorry to not answer the question, dont know off the top of my head but the forums of Mr.excel.com have lots of answers, I have used them many of times. Hope it helps

    http://www.mrexcel.com/forum/index.php
Sign In or Register to comment.