Consulting

Results 1 to 5 of 5

Thread: Solved: Auto Comment

  1. #1
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location

    Solved: Auto Comment

    Need a script that can do something like this.
    When range C:C has a value then insert Comment "Comment Here"

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]
    Private Sub Worksheet_Change(ByVal Target As Range)
    Const WS_RANGE As String = "C:C"

    On Error GoTo ws_exit
    Application.EnableEvents = False

    If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
    With Target
    .AddComment "Comment here"
    End With
    End If

    ws_exit:
    Application.EnableEvents = True
    End Sub
    [/vba]
    This is worksheet event code, which means that it needs to be
    placed in the appropriate worksheet code module, not a standard
    code module. To do this, right-click on the sheet tab, select
    the View Code option from the menu, and paste the code in.

  3. #3
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    How can I make the comment in BOLD

  4. #4
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    Quote Originally Posted by xld
    [vba]
    Private Sub Worksheet_Change(ByVal Target As Range)
    Const WS_RANGE As String = "C:C"

    On Error GoTo ws_exit
    Application.EnableEvents = False

    If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
    With Target
    .AddComment "Comment here"
    .Comment.Shape.TextFrame.Characters.Font.Bold = True
    End With
    End If

    ws_exit:
    Application.EnableEvents = True
    End Sub
    [/vba]
    Charlize

  5. #5
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    Perfect Thanks.

Posting Permissions

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