Consulting

Page 2 of 2 FirstFirst 1 2
Results 21 to 22 of 22

Thread: Manipulate Cell Comments

  1. #21
    Quote Originally Posted by mikerickson
    You could use this UDF.
    If you put =SetComment(A1, B1) in a cell, then the comment in B1 will show the value of cell A1.

    [VBA]Function SetComment(commentString As String, Optional cellOfComment As Range) As Boolean
    Dim Flag As Boolean
    On Error GoTo Halt

    If cellOfComment Is Nothing Then Set cellOfComment = Application.Caller
    If commentString = vbNullString Then commentString = " "
    Set cellOfComment = cellOfComment.Cells(1, 1)

    cellOfComment.Comment.Text commentString
    SetComment = True

    Exit Function
    Halt:
    If Err = 91 And Not Flag Then
    cellOfComment.AddComment
    Flag = True
    Resume
    End If
    End Function[/VBA]

    Mike, I tried your method and it works great and it actually might be easier doing it that way since Im going to be using this function alot throughout the project thanks alot for your help and sorry for the late response.

  2. #22
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    I'm glad that it helped.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •