+ Reply to Thread
Results 1 to 6 of 6

Macro error - to extract first and second word from a string

  1. #1
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Macro error - to extract first and second word from a string

    Hello All

    I have this macro which extracts first word and last word from Column A
    Please Login or Register  to view this content.

    The macro runs and gives the desired result but also gives run time error 1004 ... Application defined or object defined error.

    My requirement is to extract the first and second word from Column A. I got the formula from CPearson website and changed the .Columns(2) formula to get the second word from Column A. Pls note that the formula works but gives run time error 1004 as mentioned above

    .Columns(2).Formula = "=TRIM(IF(ISERROR(FIND("" "",A2,1)),A2,MID(A2,FIND("" "",A2,1)+1,IF(ISERROR(FIND("" "",A2,FIND("" "",A2,1)+2)),LEN(A2),FIND("" "",A2,FIND("" "",A2,1)+2))-FIND("" "",A2,1))))"


    My other requirement is to have @abc.org added to the value in Columns C.
    Eg if the value in Column A John Dyson Project Work
    then the macro should display John in Column B and [email protected] in Column C
    I tried to add &"abc.org" in the end of Columns(2) formula...but it did not work.

    Any help would be greatly appreciated
    PRKhan
    Last edited by Leith Ross; 08-18-2010 at 01:37 PM. Reason: Added Code Tags

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Macro error - to extract first and second word from a string

    Hi and welcome to the board. Do you need a macro or would a formula do?

  3. #3
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Re: Macro error - to extract first and second word from a string

    A macro is desired please
    Thanks

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Macro error - to extract first and second word from a string

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Re: Macro error - to extract first and second word from a string

    Works great.
    Thanks a lot
    PRKhan

  6. #6
    Registered User
    Join Date
    01-20-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Macro error - extract last used cell

    Hi:

    I was using a Macro in Office 2007 and life was beautiful. Then came Office 2010. One workbook in Excel opens a new Word document.

    Here is my Macro:

    Please Login or Register  to view this content.

    In the last line, the code stops in (xlUp) , and the error displayed is: "Can't find project or Library" .

    What am I missing ?

    Thanks,
    R

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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