DateDiff assistance
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: DateDiff assistance

  1. #1
    Join Date
    Jul 2014

    DateDiff assistance

    So I need some help debugging some code. I'm trying to create a macro that updates the years since a date that is given in column 16 of each row then placing that number of years in row Sub dateUpD8()
    x = 3
    Do Until Cells(x, 16).Value = ""
    d = Cells(x, 16).Value
    fromDate = CDate(d)
    toDate = CDate(Now)
    Cells(x, 27).Value = DateDiff("y", fromDate, toDate)
    x = x + 1
    End Sub

    What am I doing wrong?

  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008

    Re: DateDiff assistance

    Cells(x, 27).Value = DateDiff("yyyy", fromDate, toDate)
    Else maybe you should tell us what problem you are having.
    Always use [code][/code] tags when posting code.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center