Skip to sidebar Skip to content
Ipercube Technical
Jack of all trades, master of none
Date: Time: - Stardate:
Welcome, Log in by clicking  Here!
SS64
MDN
Stack
Code
GitHub
Wiki
Convert
V Studio
  • Home
  • VB Functions
    • Access Functions
    • Assembly Info
    • Color/Image Functions
    • Data Table Functions
    • Email Functions
    • Active Directory Functions
    • LDAP Functions
    • Excel Functions
    • Logging Functions
    • Source Code Retrieval
    • String Functions
    • Sql Functions
    • Object Utilities Functions
    • System and Utilities
    • Utility Forms
  • VB Classes
    • Environment Variables Helper
  • ABAP
    • ABAP Reports
    • ABAP HTTP Functions
Ipercube Technical
  • Home
  • VB Functions
    • Access Functions
    • Assembly Info
    • Color/Image Functions
    • Data Table Functions
    • Email Functions
    • Active Directory Functions
    • LDAP Functions
    • Excel Functions
    • Logging Functions
    • Source Code Retrieval
    • String Functions
    • Sql Functions
    • Object Utilities Functions
    • System and Utilities
    • Utility Forms
  • VB Classes
    • Environment Variables Helper
  • ABAP
    • ABAP Reports
    • ABAP HTTP Functions

Utility – Add Comment

Adds a formatted comment to the specified Excel cell.

If the cell already contains a comment, it will be deleted before adding the new one. The comment is inserted with specified formatting and set to be hidden by default.

VB
    Public Sub xlAddComment(Cell As Excel.Range, 
                            Text As String, 
                            Optional Bold As Boolean = False, 
                            Optional Font As String = "Consolas", 
                            Optional Size As Integer = 12)

        Try
            With Cell
                If .Comment IsNot Nothing Then .Comment.Delete()
                .AddComment()
                .Comment.Visible = False
                .Comment.Text(Text)
                .Comment.Shape.TextFrame.AutoSize = True
                .Comment.Shape.TextFrame.Characters.Font.Bold = Bold
                .Comment.Shape.TextFrame.Characters.Font.Size = Size
                .Comment.Shape.TextFrame.Characters.Font.Name = Font
            End With

        Catch ex As Exception
        End Try

    End Sub

Posted by ipercube


© 2026 Ipercube Design