+ Reply to Thread
Results 1 to 7 of 7

text to comments

  1. #1
    Registered User
    Join Date
    04-01-2009
    Location
    WashDC
    MS-Off Ver
    Excel 2003
    Posts
    84

    text to comments

    I'm trying to convert a bunch of text to comments. I found this snippet online:

    Sub TextToComments()
    'Updateby20141128
    Dim Rng As Range
    Dim WorkRng As Range
    On Error Resume Next
    xTitleId = "TextToComments"
    Set WorkRng = Application.Selection
    Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
    For Each Rng In WorkRng
    Rng.NoteText Text:=Rng.Value
    Next
    End Sub

    The problem is, it skips a lot of the cells in the range. It skips longer cells, but it's not merely that it's running to some length limit, since it skips some that are shorter than some it doesn't skip. I can't tell any reason it's picking some and not others.

  2. #2
    Registered User
    Join Date
    04-01-2009
    Location
    WashDC
    MS-Off Ver
    Excel 2003
    Posts
    84

    Re: text to comments

    Also: if I copy/paste, I can take any cell's contents and turn it into the corresponding comment. That is, they fit fine, and there are no weird hidden codes or something that are getting in the way...

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: text to comments

    Hello and welcome to the forum.

    The code works fine for me for a number of cells with "the quick brown fox jumped over the lazy dog". Cells $C$4:$O$19 are selected but only 32 out of the 208 have the text in them. All cells with text had a comment inserted.

    Please take a few moments to read the forum rules. In particular:


    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here


    You would do well to attach a sample workbook that demonstrates the problem.

    To attach a sample workbook: Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    04-01-2009
    Location
    WashDC
    MS-Off Ver
    Excel 2003
    Posts
    84

    Re: text to comments

    Thanks for the help, and thanks for the schooling. Let me try again. Here's the code snippet:

    Please Login or Register  to view this content.
    To reiterate: some comments were not created, despite that 1) the lengths of those fields were not necessarily longer than others that were created, and 2)I can create those same comments manually, so it's clearly not a limit of the comment field.

    If this gets fixed, I wish ctrl-return line feeds could be copied into comments, they seem to get lost in the process. anyway, thanks for any help! Also, I'm using 2013
    Attached Files Attached Files

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: text to comments

    One way:

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Registered User
    Join Date
    04-01-2009
    Location
    WashDC
    MS-Off Ver
    Excel 2003
    Posts
    84

    Re: text to comments

    With the holidays I didn't get to try this until now. It's cool, I like the vblf piece. I need to play with it, understand it a little better, change it up a little, but it seems pretty great. So I wanted say thanks for now!!! Your careful structuring, both visual and procedural, is helpful to someone just learning the language.

    Keith

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: text to comments

    You're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. copy cell text to comments in excel 2010 and vise versa (i.e. from comments to cell)
    By senthile in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-25-2014, 12:16 PM
  2. Comments text box
    By sentinela in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-29-2009, 08:48 AM
  3. [SOLVED] Text Box Comments
    By TashaTart in forum Excel General
    Replies: 0
    Last Post: 05-03-2006, 11:20 AM
  4. Lookup Text in Comments
    By malik641 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 09-06-2005, 12:05 PM
  5. Search Text in Comments
    By malik641 in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 07-19-2005, 02:10 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