default_name
Board Regular
- Joined
- May 16, 2018
- Messages
- 180
- Office Version
- 365
- 2016
- Platform
- Windows
- MacOS
I have set up a weekly log of my work, etc.
Each day I enter in the amount of time spent on certain tasks.
When I enter a number, I am prompted to write a brief explanation of the specific work I did.
The explanations are stored as comments, which appear as I hover over them.
Awesome! This is what I want it to do.
There is, however, something I am trying to change.
If I change the number of hours I am re-promted for a new explanation, and the previous explanation/comment is overwritten.
It is somewhat inconvenient when I have to copy my current comment/explanation (which are sometimes fairly long and detailed) so that I can then change the contents of the cell (update the time slightly), and then paste the previous comment/explanation again.
In other words, the cell content is changing (the amount of time spent) but I want the comment to remain as it was.
If the cell already has content, is there a way to alter the cell, while keeping the current comment (disabling the prompt that asks for a new comment/explanation)?
Here is the code I am currently using to make this happen (I have this message board to thank for helping me with this original code):
Also, is there any way that I can auto-format the size of the comment box to fit however much text is in the comment?
I normally have to manually go in and edit the size of the comment box in order to see everything for long or detailed comments.
Hopefully this makes sense.
Thanks in advance for your help!
Each day I enter in the amount of time spent on certain tasks.
When I enter a number, I am prompted to write a brief explanation of the specific work I did.
The explanations are stored as comments, which appear as I hover over them.
Awesome! This is what I want it to do.
There is, however, something I am trying to change.
If I change the number of hours I am re-promted for a new explanation, and the previous explanation/comment is overwritten.
It is somewhat inconvenient when I have to copy my current comment/explanation (which are sometimes fairly long and detailed) so that I can then change the contents of the cell (update the time slightly), and then paste the previous comment/explanation again.
In other words, the cell content is changing (the amount of time spent) but I want the comment to remain as it was.
If the cell already has content, is there a way to alter the cell, while keeping the current comment (disabling the prompt that asks for a new comment/explanation)?
Here is the code I am currently using to make this happen (I have this message board to thank for helping me with this original code):
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim R As Range, c As Range, Cmnt As String
Set R = Range("G3:K15,G21:K33")
If Not Intersect(Target, R) Is Nothing Then
Application.EnableEvents = False
For Each c In Intersect(Target, R)
If c.Value = "" Then c.ClearComments
Again: If LCase(c.Value) > "0" Then
If c.Comment Is Nothing Then
Cmnt = InputBox("What did you do for the amount of time you entered?", "Brief Explanation of Labor")
If Cmnt = "" Then
Application.EnableEvents = True
Exit Sub
End If
c.AddComment
c.Comment.Text Text:=Cmnt
Else
c.ClearComments
GoTo Again
End If
End If
Next c
End If
Application.EnableEvents = True
End Sub
Also, is there any way that I can auto-format the size of the comment box to fit however much text is in the comment?
I normally have to manually go in and edit the size of the comment box in order to see everything for long or detailed comments.
Hopefully this makes sense.
Thanks in advance for your help!
Last edited: