Conditional Format Comment?

leonem

New Member
Joined
Apr 5, 2006
Messages
36
Is there a way to set a conditional format so that if it meets my desired conditions I can have a predetermined comment inserted? I have never seen anything like this so dont know if it is possible.

Thanks
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hello: Maybe with a little code. Using the WorkSheet_Change Event, something like this
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub
    If Target.Address <> "$C$4" Then Exit Sub
    If Target > 100 Then
        Target.ClearComments
        Target.AddComment ("Comment 1")
        Exit Sub
    End If
    If Target > 50 Then
        Target.ClearComments
        Target.AddComment ("Comment 2")
        Exit Sub
    End If
    'etc
End Sub

This is very basic, but without knowing your requirements and cells of interest, I can't be more specific.

You might also, depending on you needs, elect to use Select Case instead of IFs

lenze
 
Upvote 0
Is there anyway i can make the comment show without having to format the cell to "show comment"???
 
Upvote 0
Is there anyway i can make the comment show without having to format the cell to "show comment"???

I don't understand your question. You can hide or show the comments under Tools>Options. Is that what you mean?

Maybe this is what you mean. You can add the line
Code:
Target.Comment.Visible = True
So now you have
Code:
Private Sub Worksheet_Change(ByVal Target As Range) 
    If Target.Count > 1 Then Exit Sub 
    If Target.Address <> "$C$4" Then Exit Sub 
    If Target > 100 Then 
        Target.ClearComments 
        Target.AddComment ("Comment 1") 
        Target.Comment.Visible = True
        Exit Sub 
    End If 
    If Target > 50 Then 
        Target.ClearComments 
        Target.AddComment ("Comment 2") 
        Target.Comment.Visible = True
         Exit Sub 
    End If 
    'etc 
End Sub

You will also need to write some script to make the comment go away
EDIT: You can use the Before_DoubleClick to remove the comment

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
      Target.Comment.Visible = False
      Cancel = True
End Sub

HTH

lenze
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,236
Members
448,555
Latest member
RobertJones1986

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top