Automatic Comment - Date Overdue

Mr Nolen

New Member
Joined
Feb 15, 2018
Messages
6
Hello good people of MrExcel,

I need a way for Excel to automatically create a comment "Comment Generated on (Today's date)" in a specific field, let's say "Q9", when the date in field "U9" is -180 days or more from today's date or rather when 180 days or more have passed. I have been searching google and these forums, and I've found something similar, but not quite what I needed. Any help is appreciated!
 
OK this should do it.

The Below strips all previous comments, and writes new comments against overdue items. It ignores blank cells and moves to the next cell.

re reading you first post your dates are in column u, so change instances of q to u, and 17 to 21 if these are the field you use.

Code:
Sub commentoverdue()
Dim a As Range
Dim LR As Long
Set a = Range("q1")
LR = Cells(Rows.Count, 17).End(xlUp).Row
ActiveSheet.Cells.ClearComments
For i = 1 To LR
'If ActiveSheet.Range("q" & i) <> "" Then
If DateDiff("d", Range("q" & i), Date) > 180 And ActiveSheet.Range("q" & i) <> "" Then
With ActiveSheet.Range("q" & i).AddComment
 .Visible = False
 .Text "reviewed on " & Date
End With
End If
Next i
End Sub

Let me know if this does it for you.

Cheers.

Dan.

Dan,

This is perfect! Thank you! I was able to get it working with that code. I just have one last question, is there a way to get it to only apply to "Q9" through "Q234" or ignore blank cells. It seems to stop working after hitting a cell without a date.
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I apologize, it is definitely ignoring blank cells. I had previous data entered that was blocking it. Thank you again!
 
Upvote 0

Forum statistics

Threads
1,216,119
Messages
6,128,947
Members
449,480
Latest member
yesitisasport

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top