Calculating Days Between Two Dates - 2

Subtracting The Today's Date From Cell Date And Viewing Result In Cell Comment

          In this study, we have used the same template again. When the button on userform is clicked  , today's date is subtracted from the date in cell. Result can be viewed on the added comment in cell.

Example :  20.10.2017 - 21.09.2016 (Today's date) = 394 days

excel calculating days

VBA codes to add comment :
Private Sub CommandButton1_Click() 'Comments are added
Application.ScreenUpdating = False
CommandButton2_Click                     'To delete If cell has comment
On Error Resume Next
For Each cell In Sheets("liste").Range("A2:A" & Cells(Rows.Count, 1).End(xlUp).Row)
cell.AddComment
cell.Comment.Visible = True
cell.Comment.Shape.Select
cell.Comment.Shape.TextFrame.AutoSize = True
cell.Comment.Text Text:=CStr(DateDiff("d", Date, cell.Value))
Next

Call create_comment_shape
Application.ScreenUpdating = True
Range("A1").Activate
End Sub

2 comments:

  1. Hi sir, I have a workbook with 2 sheets, sheet1 is ("DRY FISH"), SHEET2 IS ("SUMMARY"). And sheet 1 got 13 columns and i run a advanced filter code to summarize the sheet whis dynamic.
    In sheet 2 im getting the result but now i want sumup the value according to the filter under 3 criteria. Can i send u a mail sir? Will you help me? Thank you

    ReplyDelete
    Replies
    1. ok , send your excel file to me : kudreter@mynet.com

      Delete