+ Reply to Thread
Results 1 to 9 of 9

Display cell comment in text box

  1. #1
    Registered User
    Join Date
    10-06-2020
    Location
    Liverpool, UK
    MS-Off Ver
    2010
    Posts
    5

    Display cell comment in text box

    Hi,

    I've knocked up a calendar in Excel 2010 and i have buttons that fill a cell with a given colour for different tasks, as well as this ive made it such that a message box appears so that i can add a cell comment for that date.

    I'd like to be able to highlight a cell that has a comment and have that comment display in a text box / other cell to make for easier reading, is this doable?

    I should add im using Excel 2010.

    Thanks in advance!

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Display cell comment in text box

    not sure if you can do this with cell linking or pointing, but you can obviously do it with code. see these:

    https://docs.microsoft.com/en-us/off.../excel.comment

    https://docs.microsoft.com/en-us/off....range.comment

  3. #3
    Registered User
    Join Date
    10-06-2020
    Location
    Liverpool, UK
    MS-Off Ver
    2010
    Posts
    5

    Re: Display cell comment in text box

    Thanks, although im trying to get the text box to display the comment for whichever cell is highlighted, rather than for a set cell reference. I've played around with lots of variations of 'activecell.value' etc. but cant seem to find the right syntax

  4. #4
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Display cell comment in text box

    post the code you already tried.

  5. #5
    Registered User
    Join Date
    10-06-2020
    Location
    Liverpool, UK
    MS-Off Ver
    2010
    Posts
    5

    Re: Display cell comment in text box

    So i've tried:

    TextBox1.Value = ActiveCell.NoteText
    TextBox1.Value = ActiveCell.Comment
    TextBox1.Text = ActiveCell.NoteText
    TextBox1.Text = ActiveCell.Comment

    Plus probably a few others ive since deleted, am i completely barking up the wrong tree?

    I've also tried using the following to get the comment text into a cell and then linking the text box that cell:


    Function ReturnComment(cell As Range)

    CellComment = ActiveCell.Comment.Text

    End Function

    But no joy, I keep getting various run time errors, also thanks again for the help!

  6. #6
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Display cell comment in text box

    where is the box? sitting on top of the sheet, or on a userform? where are you putting this statement?
    Please Login or Register  to view this content.
    in a code routing?

  7. #7
    Registered User
    Join Date
    10-06-2020
    Location
    Liverpool, UK
    MS-Off Ver
    2010
    Posts
    5
    Quote Originally Posted by vba_php View Post
    where is the box? sitting on top of the sheet, or on a userform? where are you putting this statement?
    Please Login or Register  to view this content.
    in a code routing?
    Its on top of the sheet, the code is just in a subroutine in VBA, ive tried attaching to the text box but didnt work, dont think thats right anyway? I tried using it in a workbook_open sub but didnt work either. I also tried creating a button to test it but nope!

  8. #8
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Display cell comment in text box

    what TYPE of control is it? activeX, or Form? post a screenshot of it sitting on top of the worksheet

    regarding the RIGHT way to do what you're doing, yeah, you're going through a lot of wasted time here. there must be a better way

  9. #9
    Registered User
    Join Date
    10-06-2020
    Location
    Liverpool, UK
    MS-Off Ver
    2010
    Posts
    5

    Re: Display cell comment in text box

    So i've cracked it, although probably not the most elegant way. I've created a button (using a text box) and attached the macro to that, code reads as follows:


    Sub TextBox2_Click()

    Dim CellComment As String

    CellComment = ActiveCell.Comment.Text

    Range("AQ15").Value = CellComment

    End Sub



    I've then just linked the display text box to cell AQ15 in the formula bar and set the text in AQ15 to white so you wouldnt know the difference. Thanks for the help anyway!

+ 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. Best way to display text from another field in spreasheet as a comment on hover
    By jancliff in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-07-2018, 12:40 PM
  2. [SOLVED] Display cell comment in UserForm TextBox
    By chrisowen in forum Excel General
    Replies: 7
    Last Post: 01-28-2015, 02:25 PM
  3. Cell's text / comment (no comment )
    By Marianus in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-22-2013, 06:05 AM
  4. How do I display the comment associated with a Name Cell(s)?
    By mkam in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-09-2013, 10:11 PM
  5. How to Display a comment box depending on the cell value
    By sameister in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-20-2013, 09:22 AM
  6. Excel 2007 : Display cell comment on picture clik
    By Solihull in forum Excel General
    Replies: 2
    Last Post: 03-20-2011, 05:21 PM
  7. Display the TEXT of a comment in a new cell
    By wojo in forum Excel General
    Replies: 20
    Last Post: 11-17-2010, 05:01 AM

Tags for this Thread

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