robertdodson1979
New Member
- Joined
- May 30, 2014
- Messages
- 7
My goal on the form is simply that when you click the check-box, it will highlight the cell green and place the date in the cell comment, and then clear the comment and color when unchecked.
Thanks to resources such as this one, I have been successful with the exception that I can only place text in the comment, but not a date stamp or even a reference to a hidden cell. I accomplished a date stamp command on a button with "Sheets("Sheet1").Range("Q5").Value = Date" but am unable to do this in a comment.
Below is what I have currently. I know it is not clean to look at, but that is how I found it and didn't want to create more variables for troubleshooting
Private Sub CheckBox1_Change()
Sheets("Sheet1").Range("Q4").ClearComments
Sheets("Sheet1").Range("Q4").Interior.Color = RGB(255, 255, 255)
End Sub
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Sheets("Sheet1").Range("Q4").ClearComments
Sheets("Sheet1").Range("Q4").AddComment ("Hello")
Sheets("Sheet1").Range("Q4").Comment.Visible = False
Sheets("Sheet1").Range("Q4").Interior.Color = RGB(0, 255, 0)
End If
End Sub
I swear that I searched around for the answer to this before posting. I came across a couple results that seemed promising, but the code seemed to have a different syntax and I couldn't make it work with my VBA newbie skill level (started yesterday).
Thanks in advance for your time!
Thanks to resources such as this one, I have been successful with the exception that I can only place text in the comment, but not a date stamp or even a reference to a hidden cell. I accomplished a date stamp command on a button with "Sheets("Sheet1").Range("Q5").Value = Date" but am unable to do this in a comment.
Below is what I have currently. I know it is not clean to look at, but that is how I found it and didn't want to create more variables for troubleshooting
Private Sub CheckBox1_Change()
Sheets("Sheet1").Range("Q4").ClearComments
Sheets("Sheet1").Range("Q4").Interior.Color = RGB(255, 255, 255)
End Sub
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Sheets("Sheet1").Range("Q4").ClearComments
Sheets("Sheet1").Range("Q4").AddComment ("Hello")
Sheets("Sheet1").Range("Q4").Comment.Visible = False
Sheets("Sheet1").Range("Q4").Interior.Color = RGB(0, 255, 0)
End If
End Sub
I swear that I searched around for the answer to this before posting. I came across a couple results that seemed promising, but the code seemed to have a different syntax and I couldn't make it work with my VBA newbie skill level (started yesterday).
Thanks in advance for your time!