Consulting

Results 1 to 5 of 5

Thread: Solved: Extracting only part which is within brackats

  1. #1
    VBAX Regular jigar1276's Avatar
    Joined
    Jun 2008
    Location
    Ahmedabad
    Posts
    42
    Location

    Question Solved: Extracting only part which is within brackats

    Hi Experts,

    I have a cell with the value: "Team - I (LeaderName)".

    I want a macro which should give me only the characters which are in between open bracket and close bracket, i.e. LeaderName.
    LeaderName may have different lengths based on different team names (Team - I, Team - II, Team - III).

    Thanks...

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You can do it without a macro

    =MID(A20,FIND("(",A20)+1,FIND(")",A20)-FIND("(",A20)-1)
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular jigar1276's Avatar
    Joined
    Jun 2008
    Location
    Ahmedabad
    Posts
    42
    Location
    Thanks Xld,

    Actually i am using the extracted name in one of my macro. I tried the Find() within my main macro and it gave me error.

    I was looking for the similar of Excel-Find to use in Macro.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Okay, same approach

    [vba]

    With Range("A20")

    ExtractedName = Mid(.Value, InStr(.Value, "(") + 1, InStr(.Value, ")") - InStr(.Value, "(") - 1)
    End With
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Regular jigar1276's Avatar
    Joined
    Jun 2008
    Location
    Ahmedabad
    Posts
    42
    Location
    Thats what i was looking for. It is working fine within my main macro code now.

    Thanks Xld..

Posting Permissions

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