+ Reply to Thread
Results 1 to 6 of 6

Comment Object being recognized as 'Nothing'

  1. #1
    Registered User
    Join Date
    08-24-2021
    Location
    Atlanta, Georgia
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    4

    Comment Object being recognized as 'Nothing'

    Hi y'all,

    I'm trying to create a macro capable of performing a function when a given cell contains a comment. I have read in many places to use "If Not . Comment Is Nothing Then", but every time I test it out with a cell I know has a comment, it recognizes the condition object as 'Nothing'

    Sheet.png.jpg

    Code.jpg

    As seen, cell C2 has a comment, but when I hover over the TestObj it displays as nothing. I have also tried with CommentThreaded and other related objects but I cannot get it to work.

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,527

    Re: Comment Object being recognized as 'Nothing'

    Try (Change references as required)
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-24-2021
    Location
    Atlanta, Georgia
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    4

    Re: Comment Object being recognized as 'Nothing'

    I get a Run-Time error when trying it. I used an object variable to be able to see what the object gets recognized as and sure enough, it still recognizes it as 'Nothing'.

    Attachment 745272

  4. #4
    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: Comment Object being recognized as 'Nothing'

    Answered many years ago on this forum. See: https://www.excelforum.com/excel-gen...in-a-cell.html
    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


  5. #5
    Registered User
    Join Date
    08-24-2021
    Location
    Atlanta, Georgia
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    4

    Re: Comment Object being recognized as 'Nothing'

    I have looked at both the responses on that thread before, still have issues.

    Please Login or Register  to view this content.
    This still prints "Nothing" on C2 even though cell B2 (the cell called by Cells(2,2)) has a comment.
    Last edited by BreitLink; 08-24-2021 at 02:10 PM.

  6. #6
    Registered User
    Join Date
    08-24-2021
    Location
    Atlanta, Georgia
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    4

    Re: Comment Object being recognized as 'Nothing'

    For any future users that have this same problem, I eventually found a way to check the existence of a comment in a given cell using .CommentThreaded.

    Please Login or Register  to view this content.
    For some reason, .Comment didn't work for this type of condition, yet .Comment.Text was able to print the text inside the comment.

+ 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. UserForm not recognized as object despite declaration
    By Greg Yarick in forum Office 365
    Replies: 3
    Last Post: 04-08-2020, 11:10 AM
  2. [SOLVED] Need Help with Toggle Excel Comment Object
    By ptmuldoon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2014, 01:02 PM
  3. Can you link a comment to a shape/object button?
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-21-2014, 07:08 AM
  4. ActiveDocument object not recognized
    By LauraBorealis in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-14-2006, 04:55 PM
  5. add comment to object
    By Ronbo in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-09-2006, 09:00 PM
  6. [SOLVED] What is the deal with Comment Object Positioning?
    By Mark in forum Excel General
    Replies: 3
    Last Post: 06-09-2005, 07:05 PM
  7. Attach comment to object
    By Neil Jimack in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-11-2005, 10:06 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