Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default timestamp comments

I am looking for a small piece of code that will format a comment feild in
microsoft excel to start with the current date and time.

this is details of what exactly the code needs to do:

1.Insert Comment
2.Code inserts date and timestamp into the newly opened comment field.
3.If you select "Edit Comment", it will create a two 's after the last typed
word (paragraph). And then timestamp there.

could anyone lend a hand? (well, alittle more than a hand)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default timestamp comments

Hi Ben

Only possible with code as far as I know

See this page
http://www.contextures.com/xlcomments01.html



--
Regards Ron de Bruin
http://www.rondebruin.nl


"BenMetz" wrote in message ...
I am looking for a small piece of code that will format a comment feild in
microsoft excel to start with the current date and time.

this is details of what exactly the code needs to do:

1.Insert Comment
2.Code inserts date and timestamp into the newly opened comment field.
3.If you select "Edit Comment", it will create a two 's after the last typed
word (paragraph). And then timestamp there.

could anyone lend a hand? (well, alittle more than a hand)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default timestamp comments

helped me a few ways. show me how to add a comment, and how to remove the
username. however, i have no programming knowledge and wouldn't be able to
complete the script :) so buddy, wanna just write it all for me? :/ (sorry
for being lazy, don't have the time to start learning syntax.)

"Ron de Bruin" wrote:

Hi Ben

Only possible with code as far as I know

See this page
http://www.contextures.com/xlcomments01.html



--
Regards Ron de Bruin
http://www.rondebruin.nl


"BenMetz" wrote in message ...
I am looking for a small piece of code that will format a comment feild in
microsoft excel to start with the current date and time.

this is details of what exactly the code needs to do:

1.Insert Comment
2.Code inserts date and timestamp into the newly opened comment field.
3.If you select "Edit Comment", it will create a two 's after the last typed
word (paragraph). And then timestamp there.

could anyone lend a hand? (well, alittle more than a hand)




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default timestamp comments

Hi Ben

You can run this macro if you want to add a comment with date/time stamp or change the date/time in the comment.

Sub Test()
Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
ActiveCell.AddComment
ActiveCell.Comment.Text Text:=Format(Now, "dd-mmm-yy hh-mm-ss")
Else
If IsNumeric(Right(ActiveCell.Comment.Text, 2)) Then
ActiveCell.Comment.Text Text:=Left(ActiveCell.Comment.Text, Len(ActiveCell.Comment.Text) - 18) _
& Format(Now, "dd-mmm-yy h-mm-ss")
Else
ActiveCell.Comment.Text Text:=ActiveCell.Comment.Text & Chr(10) & Format(Now, "dd-mmm-yy hh-mm-ss")
End If
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"BenMetz" wrote in message ...
helped me a few ways. show me how to add a comment, and how to remove the
username. however, i have no programming knowledge and wouldn't be able to
complete the script :) so buddy, wanna just write it all for me? :/ (sorry
for being lazy, don't have the time to start learning syntax.)

"Ron de Bruin" wrote:

Hi Ben

Only possible with code as far as I know

See this page
http://www.contextures.com/xlcomments01.html



--
Regards Ron de Bruin
http://www.rondebruin.nl


"BenMetz" wrote in message ...
I am looking for a small piece of code that will format a comment feild in
microsoft excel to start with the current date and time.

this is details of what exactly the code needs to do:

1.Insert Comment
2.Code inserts date and timestamp into the newly opened comment field.
3.If you select "Edit Comment", it will create a two 's after the last typed
word (paragraph). And then timestamp there.

could anyone lend a hand? (well, alittle more than a hand)






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default timestamp comments

Or to add another date at the end of the existing comment, and open the
comment for editing:

'=========================
Sub CommentDateTimeAdd()

Dim strDate As String
Dim cmt As Comment
Dim lBreak As Long
Dim lArea As Long

strDate = "dd-mmm-yy hh:mm:ss"
Set cmt = ActiveCell.Comment

If cmt Is Nothing Then
Set cmt = ActiveCell.AddComment
cmt.text text:=Format(Now, strDate) & Chr(10)
Else
cmt.text text:=cmt.text & Chr(10) _
& Format(Now, strDate) & Chr(10)
End If

With cmt.Shape.TextFrame
.Characters.Font.Bold = False
End With

SendKeys "%ie~"

End Sub
'=========================

Ron de Bruin wrote:
Hi Ben

You can run this macro if you want to add a comment with date/time stamp or change the date/time in the comment.

Sub Test()
Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
ActiveCell.AddComment
ActiveCell.Comment.Text Text:=Format(Now, "dd-mmm-yy hh-mm-ss")
Else
If IsNumeric(Right(ActiveCell.Comment.Text, 2)) Then
ActiveCell.Comment.Text Text:=Left(ActiveCell.Comment.Text, Len(ActiveCell.Comment.Text) - 18) _
& Format(Now, "dd-mmm-yy h-mm-ss")
Else
ActiveCell.Comment.Text Text:=ActiveCell.Comment.Text & Chr(10) & Format(Now, "dd-mmm-yy hh-mm-ss")
End If
End If
End Sub




--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default timestamp comments

Thanks Debra for this version

Add it to your site
I am sure others can use it to

Ron

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Debra Dalgleish" wrote in message ...
Or to add another date at the end of the existing comment, and open the comment for editing:

'=========================
Sub CommentDateTimeAdd()

Dim strDate As String
Dim cmt As Comment
Dim lBreak As Long
Dim lArea As Long

strDate = "dd-mmm-yy hh:mm:ss"
Set cmt = ActiveCell.Comment

If cmt Is Nothing Then
Set cmt = ActiveCell.AddComment
cmt.text text:=Format(Now, strDate) & Chr(10)
Else
cmt.text text:=cmt.text & Chr(10) _
& Format(Now, strDate) & Chr(10)
End If

With cmt.Shape.TextFrame
.Characters.Font.Bold = False
End With

SendKeys "%ie~"

End Sub
'=========================

Ron de Bruin wrote:
Hi Ben

You can run this macro if you want to add a comment with date/time stamp or change the date/time in the comment.

Sub Test()
Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
ActiveCell.AddComment
ActiveCell.Comment.Text Text:=Format(Now, "dd-mmm-yy hh-mm-ss")
Else
If IsNumeric(Right(ActiveCell.Comment.Text, 2)) Then
ActiveCell.Comment.Text Text:=Left(ActiveCell.Comment.Text, Len(ActiveCell.Comment.Text) - 18) _
& Format(Now, "dd-mmm-yy h-mm-ss")
Else
ActiveCell.Comment.Text Text:=ActiveCell.Comment.Text & Chr(10) & Format(Now, "dd-mmm-yy hh-mm-ss")
End If
End If
End Sub




--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default timestamp comments

thanks alot for all the replies, so far everything has worked correctly.

just curious though, can i arrange ti so either the "Insert Comment" in the
context menu activates the macro? when i set a shortcut to the macro, it adds
the date/time, but it doesn't open the comment.

and are there any other time formats? like day fo the week?

"Debra Dalgleish" wrote:

Or to add another date at the end of the existing comment, and open the
comment for editing:

'=========================
Sub CommentDateTimeAdd()

Dim strDate As String
Dim cmt As Comment
Dim lBreak As Long
Dim lArea As Long

strDate = "dd-mmm-yy hh:mm:ss"
Set cmt = ActiveCell.Comment

If cmt Is Nothing Then
Set cmt = ActiveCell.AddComment
cmt.text text:=Format(Now, strDate) & Chr(10)
Else
cmt.text text:=cmt.text & Chr(10) _
& Format(Now, strDate) & Chr(10)
End If

With cmt.Shape.TextFrame
.Characters.Font.Bold = False
End With

SendKeys "%ie~"

End Sub
'=========================

Ron de Bruin wrote:
Hi Ben

You can run this macro if you want to add a comment with date/time stamp or change the date/time in the comment.

Sub Test()
Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
ActiveCell.AddComment
ActiveCell.Comment.Text Text:=Format(Now, "dd-mmm-yy hh-mm-ss")
Else
If IsNumeric(Right(ActiveCell.Comment.Text, 2)) Then
ActiveCell.Comment.Text Text:=Left(ActiveCell.Comment.Text, Len(ActiveCell.Comment.Text) - 18) _
& Format(Now, "dd-mmm-yy h-mm-ss")
Else
ActiveCell.Comment.Text Text:=ActiveCell.Comment.Text & Chr(10) & Format(Now, "dd-mmm-yy hh-mm-ss")
End If
End If
End Sub




--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


Reply
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
Timestamp Stephanie Excel Discussion (Misc queries) 0 January 5th 10 06:55 PM
excel 2000 how to format the comments font all comments Delquestion Excel Discussion (Misc queries) 1 October 8th 09 02:19 PM
Timestamp PS Excel Discussion (Misc queries) 2 January 10th 07 02:21 PM
Timestamp Sher Excel Discussion (Misc queries) 2 November 3rd 06 04:31 PM
timestamp on each row... Starrpro50 Excel Programming 3 October 27th 04 08:37 PM


All times are GMT +1. The time now is 07:54 PM.

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"