+ Reply to Thread
Results 1 to 5 of 5

Set comment to a cell in Excel - VBA

  1. #1
    Registered User
    Join Date
    02-21-2018
    Location
    london
    MS-Off Ver
    2013
    Posts
    3

    Set comment to a cell in Excel - VBA

    Hi

    I have 2 sheets (Main and help). I want to add the comment to cells in 'main' sheet from 'Help' sheet.

    Dim V_comment As Range
    Dim test As Range
    Dim j
    For j = 1 To 20

    Set V_comment = ThisWorkbook.Sheets("Help").Cells(2 + j, 6)
    Set test = ThisWorkbook.Sheets("Main").Cells(2, j)
    With test
    .ClearComments
    .AddComment
    .Comment.Text Text:=V_comment
    End With

    Next

    I get erro in debug.

    Would you please help me?

    Thank you
    Kati

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Set comment to a cell in Excel - VBA

    Kati

    You need to check if the cells on 'Help' are empty.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-21-2018
    Location
    london
    MS-Off Ver
    2013
    Posts
    3

    Re: Set comment to a cell in Excel - VBA

    Thank you

    Do you know how to change the Author name? I added .Comment.Author = "jsdhfjdsjhf" but I get error message

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Set comment to a cell in Excel - VBA

    The Author property of a comment is read-only and is set in the General section under Tools>Options.

  5. #5
    Registered User
    Join Date
    02-21-2018
    Location
    london
    MS-Off Ver
    2013
    Posts
    3

    Re: Set comment to a cell in Excel - VBA

    Thank you very much for your help

+ 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. how to get comment box when click on excel cell?
    By msa969 in forum Excel General
    Replies: 10
    Last Post: 04-19-2017, 01:59 PM
  2. [SOLVED] Function to return comment from a cell, or null string if no comment
    By Monkihunta in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-22-2017, 01:01 PM
  3. [SOLVED] Show comment on mouse over cell rather than over comment icon....?
    By BellyGas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-16-2015, 09:05 AM
  4. Check if cell in range is empty, if it is delete comment else format comment to
    By banaanas in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-15-2015, 01:15 AM
  5. Add timestamp to comment upon comment creation (Excel 2007)
    By Shadyhaxx in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-30-2013, 12:58 PM
  6. Disable Delete Comment, Edit Comment, Show/Hide Comment
    By Shanthan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2013, 06:12 AM
  7. Excel worksheet cell comment box
    By Donald Stockton in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-02-2006, 12:15 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