+ Reply to Thread
Results 1 to 5 of 5

Extract Line From Comment

  1. #1
    Registered User
    Join Date
    03-09-2011
    Location
    Durban
    MS-Off Ver
    Excel 2007
    Posts
    15

    Extract Line From Comment

    I have placed 5 lines of info in a comment and need to extract only line three.

    Can anybody help me please, I'm a new user and will appreciate help as a dummy

    Thank you

    Vic
    Last edited by DonkeyOte; 03-10-2011 at 05:39 AM. Reason: modified title slightly

  2. #2
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Comments

    Hi,

    Where have you placed the comment?

    If it's in a macro just remove the ' sign before the commented line.

    Steffen Thomsen

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Comments

    Assuming the comment (A1 in ex.) has line breaks you can Split the comment accordingly and use the (2) item [0 based Array], eg:

    Please Login or Register  to view this content.
    you may want to add Error handler accordingly
    Last edited by DonkeyOte; 03-10-2011 at 05:41 AM. Reason: added note re: 0 based

  4. #4
    Registered User
    Join Date
    03-09-2011
    Location
    Durban
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Extract Line From Comment

    Thank you DonkeyOte, I know that is what I wanted.
    I have written as follows:

    Please Login or Register  to view this content.
    Then I get the message:

    "Object variable or with block not set"

    Can you help me with that please and thank you

    Vic
    Last edited by DonkeyOte; 03-10-2011 at 07:04 AM. Reason: added code tags

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Extract Line From Comment

    Vic, please always encase VBA code with CODE tags (per Forum Rules)

    You would get the error you describe if the ActiveCell does not contain a Comment - this was the point I was making re: adding an appropriate handler.

    Please Login or Register  to view this content.
    with the above - if the cell is comment-less or contains fewer than three distinct lines then RmNo variable will be a Null string

    Obviously when you refer to "comment" I have assumed you're referring to cell comments and not just a text string within the cell itself.

+ 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