Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 5 of 5

Thread: Adding days to date

  1. #1
    Join Date
    11th August 2004
    Posts
    103

    Adding days to date

    I have two text boxes on a userform one you manually enter the date and the other automatically calculates the date 28 days in advance. This works until you try and change the date in the manual text box then I get a Type Mismatch error

    Can anyone help please

    Code as follows:

    VB:
     
    Private Sub GTW_Date_txt_Change() 
         
        RefGTW_Date_txt = CDate(GTW_Date_txt) + 28 
         
    End Sub 
    
    
    Thanks
    Last edited by Miss KF; April 12th, 2006 at 20:23.

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    2nd March 2006
    Location
    London
    Posts
    988

    Re: Adding days to date

    What about:
    VB:
    RefGTW_Date_txt = CStr ( CDate(GTW_Date_txt) + 28 ) 
    
    

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    11th August 2004
    Posts
    103

    Re: Adding days to date

    Tried your suggestion it still gives me the Type mismatch error

    Thanks

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    8th September 2004
    Location
    Northampton, England
    Posts
    2,813

    Re: Adding days to date

    If you convert the date to a number first you should then be able to add 28 to it, then convert it back to a date, e.g.
    VB:
    CDate(DateValue(GTW_Date_txt) + 28) 
    
    
    Hope this helps.

    Regards,
    Batman.

    Excel Video Tutorials / Excel Dashboards Reports


  5. #5
    Join Date
    11th August 2004
    Posts
    103

    Re: Adding days to date

    Thanks Batman

    I've added it to the Exit procedure, I think using the Change procedure may also have been causing the problems

    Karen

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Determine Weekday Of Date Before Adding Days
    By newengwong in forum EXCEL HELP
    Replies: 6
    Last Post: September 4th, 2007, 09:39
  2. Adding Or Substracting Days From The Calculated Age
    By d_jitendra in forum EXCEL HELP
    Replies: 6
    Last Post: June 3rd, 2007, 00:56
  3. Adding Years, Days, Months To Date/time Format
    By simonpnewman in forum EXCEL HELP
    Replies: 10
    Last Post: April 26th, 2007, 20:58
  4. Adding 1 To A Number On Business Days
    By akphidelt in forum EXCEL HELP
    Replies: 5
    Last Post: September 17th, 2006, 00:01
  5. Adding days to a date
    By tjolley in forum EXCEL HELP
    Replies: 12
    Last Post: January 28th, 2006, 08:41

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
  •  
porno