LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Inserting Comments with VBA

It could have been more condensed but left it this way for ease of
undertanding.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 6 Then Exit Sub
Application.EnableEvents = False

If Target.Column = 31 Then
With Cells(Target.Row, "a")
.Comment.Text Text:=Date & Chr(10) & "Advised FH RAC Process of RAC " _
& Target & " decision" & Chr(10) & .Comment.Text
End With
End If

If Target.Column = 39 Then
With Cells(Target.Row, "a")
.Comment.Text Text:=Date & Chr(10) & "Advised FH RAC Process of FI " _
& Target & " decision" & Chr(10) & .Comment.Text
End With
End If

Application.EnableEvents = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
...
On Sep 24, 9:44 am, akemeny wrote:
Hi

I'm looking for a macro that will automatically enter the current date and
a
note in the comments box when certain information is entered into specific
cells on my spreadsheets without deleting any old comments.

For example:

When V = unfavorable, automatic comment should enter:
- The current date (Blue and Bold)
- The note (standard font and color)
When V = favorable, automatic comment should enter:
- The current date (Blue and Bold
- The note (standard font and color)
Etc.

Is this possible??


Hello:

This will insert the comment, I can't get text formatting to work in a
comments field. There is probably a way, but this will at least start
you off.

Insert this into the Worksheet code

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rng As Range
Dim MyCell As Range

MyString = Now
MyString2 = ": Unfavourable text"
MyString3 = ": Favourable text"


With Target
Select Case .Value
Case "favourable"
With .AddComment
.Text Now & MyString3
End With
Case "unfavourable"
With .AddComment
.Text Now & MyString2
End With
Case Else
'Do nothing
End Select
End With
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting Comments Greggo G[_2_] Excel Discussion (Misc queries) 1 October 28th 09 12:13 PM
Inserting comments milt Excel Worksheet Functions 3 March 28th 08 12:22 AM
Need help with inserting comments Brad Excel Programming 1 February 17th 05 03:34 AM
Inserting comments Ian Coates Excel Programming 3 February 2nd 04 06:45 PM
Inserting comments Ian Coates Excel Programming 0 February 2nd 04 03:20 PM


All times are GMT +1. The time now is 09:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"