Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro for Comment box | Excel Programming | |||
macro to insert a comment | Excel Worksheet Functions | |||
having a macro insert a comment | Excel Programming | |||
Macro to Insert Comment to a cell | Excel Programming | |||
a comment plugin & copy paste directly from excel to comment ? fr. | Excel Worksheet Functions |