LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default unmodifiable comment macro

I found where to enter the code, but now I can't make it actually work. I'm
not sure if it's because I'm on Excel 2007 and the verbage is a little bit
different or if I'm just in way in over my head.

I read through those pages you posted, and I couldn't even get the simple
one to run.:

Private Sub Worksheet_Change(ByVal Target As Range)

MsgBox "You just changed " & Target.Address

End Sub

After you enter a code like this...how do you get it to "run"

(On previous attempts with comment macros, I would just hit the run button
and it would work. Now nothing happens.)


"ryguy7272" wrote:

Will this work for you?
'Summary: Place this code in the Worksheet_Change() event procedure
' Every time a cell's value is changed the date, time , old value,
' new value, and the user are recorded in a comment.

Private Sub Worksheet_Change(ByVal Target As Range)

Dim NewText As String
Dim NewVal As Variant
Dim OldText As String
Dim OldVal As Variant

Application.EnableEvents = False
NewVal = Target.Value
Application.Undo
OldVal = ActiveCell.Value
ActiveCell = NewVal
Application.EnableEvents = True

NewText = "On " & Now() & " cell changed from " & OldVal _
& " to " & NewVal & " by " & Environ("UserName")

If ActiveCell.Comment Is Nothing Then
ActiveCell.AddComment
End If

With ActiveCell.Comment
.Shape.TextFrame.AutoSize = True
OldText = .Text & vbLf
.Text Text:=OldText & NewText
End With

End Sub

Also, see this:
http://www.contextures.com/xlcomments03.html#Plain


HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Adam at Star Packaging" wrote:

I am new to the macro world and need some help.

I am trying to set a macro that will place a comment. The information in the
comment should be:

User name. Datestamp (fixed to when macro was applied).

The comment should not be modifiable.

Is this possible?


(The object is to have this macro act as a "signature" for certain users
showing that they have "signed off" on information in specific cells.
Non-legal, intra-office use only.)

If there is an easier way than the macro suggestion above, I am open to
suggestions.

Thank you very much.

 
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
Macro for Comment box cpf Excel Programming 3 August 28th 08 05:39 PM
macro to insert a comment driller Excel Worksheet Functions 0 February 8th 07 10:22 PM
having a macro insert a comment jhahes[_31_] Excel Programming 1 September 20th 05 10:37 PM
Macro to Insert Comment to a cell wojo Excel Programming 14 July 22nd 05 02:50 PM
a comment plugin & copy paste directly from excel to comment ? fr. RFM Excel Worksheet Functions 0 December 1st 04 11:29 PM


All times are GMT +1. The time now is 05:09 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"