edge37
Board Regular
- Joined
- Sep 1, 2016
- Messages
- 57
- Office Version
- 2021
- Platform
- Windows
Hi, please help. I found this code on internet for adding date and time to a cell as comments using a button:
Sub DatedComment()
'Update 20141110
Dim pComment As Comment
Dim WorkRng As Range
Set WorkRng = Application.ActiveCell
Set pComment = WorkRng.AddComment(Application.UserName & ":" & vbLf & Now & vbLf)
pComment.Shape.TextFrame.Characters(1, VBA.Len(Application.UserName) + 1).Font.Bold = True
End Sub
It works great, but I need this code to return only the date (not time) when I hit the button so my question is, How could this code be edited to show only the date in comments?
thank you, mates.
Sub DatedComment()
'Update 20141110
Dim pComment As Comment
Dim WorkRng As Range
Set WorkRng = Application.ActiveCell
Set pComment = WorkRng.AddComment(Application.UserName & ":" & vbLf & Now & vbLf)
pComment.Shape.TextFrame.Characters(1, VBA.Len(Application.UserName) + 1).Font.Bold = True
End Sub
It works great, but I need this code to return only the date (not time) when I hit the button so my question is, How could this code be edited to show only the date in comments?
thank you, mates.