+ Reply to Thread
Results 1 to 2 of 2

Thread: Number of days between 2 sets of dates (Word table)

  1. #1
    Registered User
    Join Date
    07-04-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Number of days between 2 sets of dates (Word table)

    Hi all,

    I'm trying to find the simplest method to calculate the difference between two dates and express it as the number of days in a Word 2007 table cell.

    For example: 'Issue Delta' (Cell A) was raised on the 22/09/2010 (cell B). Number of days the issue has been unresolved (cell C)

    I'd like to find the number of days for cell C by comparing TODAY and 22/09/2010 (or another set date).

    Unfortunately formulas in Word are a bit limited - and at that point we run into my knowledge barrier!

    Any help gratefully received.

  2. #2
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: Number of days between 2 sets of dates (Word table)

    Just a little bit of VBA:

    sub snb()
      activedocument.tables(1).cell(1,3).range.text=datediff("d",cdate("22/09/2010"),date)
    end sub
    or reading from the table
    sub snb()
      with activedocument.tables(1)
         .cell(1,3).range.text=datediff("d",cdate(left(.cell(1,2).range.text,len(.cell(1,2).range.text)-2),date)
      end with
    end sub
    Last edited by snb; 07-11-2011 at 09:37 AM.



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0