Difference between dates failes

karltlbm

New Member
Joined
Jun 3, 2015
Messages
10
Hello, i have a a problem when i try to reach the number of days there are between 2 dates, my code is :
Code:
'COMPLETED
Range("D3").Select
Do While ActiveCell <> Empty
    ActiveCell.Offset(1, 0).Select
Loop
    ActiveCell.Value = CLng(date) - CLng(List_Projet(id_P).date_debut_P)
    
'REMAINING
Range("E3").Select
Do While ActiveCell <> Empty
    ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Value = CLng(List_Projet(id_P).deadline_P) - CLng(Range("G2").Value)

The remaining part works but not the completed days, can you guys help ?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Difficult to isolate a problem when we have no visibility to what your "List_Projet(id_P)" object/type is or holds, nor its associated "date_debut_P" property.

Having said that, why not use the DateDiff function rather than converting dates to long integers and subtracting them?

Code:
ActiveCell.Value = DateDiff("d", date, List_Projet(id_P).date_debut_P)
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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