View Full Version : Solved: Auto Comment
Emoncada
04-10-2007, 08:26 AM
Need a script that can do something like this.
When range C:C has a value then insert Comment "Comment Here"
Bob Phillips
04-10-2007, 09:04 AM
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
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.
Emoncada
04-10-2007, 09:44 AM
How can I make the comment in BOLD
Charlize
04-10-2007, 01:12 PM
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
Charlize
Emoncada
04-10-2007, 01:25 PM
Perfect Thanks.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.