+ Reply to Thread
Results 1 to 8 of 8

Userform textbox to combine all cells comments

  1. #1
    Forum Contributor
    Join Date
    10-07-2015
    Location
    cyprus
    MS-Off Ver
    Microsoft 365
    Posts
    182

    Userform textbox to combine all cells comments

    I have the following code which shows in the text box "notes" (in a userform) the cell comment if any

    This works fine however I would like this text box to display all the comments for each cell one after the other after a word wrap.

    here is my code working for the first cell found with comments but it overwrite the previous comments with the last found

    Please Login or Register  to view this content.
    Basically i would like to add after CHR(10) the next cell comments something like

    Please Login or Register  to view this content.
    can someone tell me if feasible and how to do it?

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Userform textbox to combine all cells comments

    In the loop add the new data to itself rather than making it equal to
    Please Login or Register  to view this content.
    So this will take whatever is in Me.Notes.Value and add the new data on the end of it.
    If someone has helped you then please add to their Reputation

  3. #3
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Userform textbox to combine all cells comments

    Note that you should use On Error Resume Next with great care. Remember it may mask an error that you actually want to catch in order to debug/correct your code.
    If you are pleased with a member's answer then use the Star icon to rate it.

  4. #4
    Forum Contributor
    Join Date
    10-07-2015
    Location
    cyprus
    MS-Off Ver
    Microsoft 365
    Posts
    182

    Re: Userform textbox to combine all cells comments

    Thank you Pjwitfield it was so simple, however it does not appear correctly as I want.

    Here a print screen of the notes box

    [ATTACH]483475[/ATTACH


    I would like it to appear

    QTE
    INSP LP: USD 1,225.00 - INSP LP
    OTHERS: USD 67.25 - wrong overage STASCO calc
    Unqte

    Buran, thank you for your advice however if I delete all the reference to on error, I got an error message "Object variable or with block variable not set"

    here the code without any reference to "on error"

    Please Login or Register  to view this content.
    Attached Images Attached Images

  5. #5
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Userform textbox to combine all cells comments

    Quote Originally Posted by mariec_06 View Post

    Buran, thank you for your advice however if I delete all the reference to on error, I got an error message "Object variable or with block variable not set"
    In your code you you use On Error Resume Next two times. The first time when you set the range. Here you don't have any reason to do so. The second case is when you try to loop over cells with comments. Here again you don't have reason to use it. You get the error because there are cells that don't have comments and you don't want to mask the error (you may have other errors - e.g. incorrect index when refer to cells rows and columns), but handle it right. Actually you try to do so using special cells, but you are not doing it right. - you select the cells with comments, but after that you again loop over all cells in rngComments, not only the selection. Another way would be to check that the cell. Comment Property is not nothing.
    Here is your code little modified, but I'm not able to test is as I don't have workbook.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    10-07-2015
    Location
    cyprus
    MS-Off Ver
    Microsoft 365
    Posts
    182

    Re: Userform textbox to combine all cells comments

    Thanks Buran

    I managed to do it too as follows but yours works fine and is simpler

    Please Login or Register  to view this content.
    However concerning the appearance I have still the same issue, the code does not insert the additional after notes.value on another line although wrapword and multilines property are set as true......

  7. #7
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Userform textbox to combine all cells comments

    can you upload a workbook. I'm not sure how your comments look like and what you want to get in the text box

  8. #8
    Forum Contributor
    Join Date
    10-07-2015
    Location
    cyprus
    MS-Off Ver
    Microsoft 365
    Posts
    182

    Re: Userform textbox to combine all cells comments

    Sorry my mistake, the comments were entered without word wrap. All solved now

    Many thank to both of you

+ 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. Choose multiple Word-Documents via UserForm TextBox and combine them to Master Word-Doc
    By ODeveloper in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-15-2015, 09:25 AM
  2. update cell/cells after updating a textbox on a userform
    By 40jmart1705 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2014, 03:07 PM
  3. [SOLVED] Unable to match Textbox comments in a Userform
    By Ortz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-02-2014, 03:23 PM
  4. [SOLVED] Placing the data from a range of cells into a userform textbox
    By brucemc777 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2014, 03:51 PM
  5. UserForm textbox data to empty cells
    By RLWells in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-29-2012, 02:42 AM
  6. Linking Cells to Textbox on a Userform
    By Mpeters3 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-09-2011, 01:15 PM
  7. Copying userform data in textbox into cells
    By dowinterfor6 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-21-2011, 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